From fe1c296971f8b93a2b5373aa9a911339c25eb3ca Mon Sep 17 00:00:00 2001 From: Anthony Weems Date: Fri, 4 Dec 2020 15:36:09 -0600 Subject: [PATCH] Fixes #20: support csproj elements with a single ItemGroup --- utils.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/utils.js b/utils.js index 2c9238e2c..02e72aaf5 100644 --- a/utils.js +++ b/utils.js @@ -1118,13 +1118,18 @@ const parseCsProjData = async function (csProjData) { if (!csProjData) { return pkgList; } - const project = convert.xml2js(csProjData, { + const projects = convert.xml2js(csProjData, { compact: true, + alwaysArray: true, spaces: 4, textKey: "_", attributesKey: "$", commentKey: "value", }).Project; + if (projects.length == 0) { + return pkgList; + } + const project = projects[0]; if (project.ItemGroup && project.ItemGroup.length) { for (let i in project.ItemGroup) { const item = project.ItemGroup[i];