Skip to content

Commit 1573e15

Browse files
committed
check the version existence
1 parent f0f2f8c commit 1573e15

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

eng/scripts/automation/GenerateAndBuildLib.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,8 +892,15 @@ function GeneratePackage()
892892
}
893893

894894
# get the sdk version
895+
$version = ""
895896
$projectFile = Join-Path $srcPath "$packageName.csproj"
896-
$version=([xml](Get-Content $projectFile)).Project.PropertyGroup.Version
897+
$csproj = new-object xml
898+
$csproj.PreserveWhitespace = $true
899+
$csproj.Load($projectFile)
900+
$versionNode = ($csproj | Select-Xml "Project/PropertyGroup/Version").Node
901+
if ($versionNode) {
902+
$version = $versionNode.InnerText
903+
}
897904
$packageDetails = @{
898905
version=$version;
899906
packageName="$packageName";

0 commit comments

Comments
 (0)