diff --git a/eng/common/scripts/Save-Package-Properties.ps1 b/eng/common/scripts/Save-Package-Properties.ps1 index 10cb4158c01f..b29a6bc02df3 100644 --- a/eng/common/scripts/Save-Package-Properties.ps1 +++ b/eng/common/scripts/Save-Package-Properties.ps1 @@ -48,8 +48,15 @@ function SetOutput($outputPath, $incomingPackageSpec) { else { $outputObject = $incomingPackageSpec + + # Set file paths to relative paths. Only do this if there is no existing + # package info json file as running this multiple times can create + # unexpected relative paths in some scenarios. + $outputObject.DirectoryPath = GetRelativePath $outputObject.DirectoryPath + $outputObject.ReadMePath = GetRelativePath $outputObject.ReadMePath + $outputObject.ChangeLogPath = GetRelativePath $outputObject.ChangeLogPath } - + if ($addDevVersion) { @@ -58,11 +65,6 @@ function SetOutput($outputPath, $incomingPackageSpec) { $outputObject.DevVersion = $incomingPackageSpec.Version } - # Set file paths to relative paths - $outputObject.DirectoryPath = GetRelativePath $outputObject.DirectoryPath - $outputObject.ReadMePath = GetRelativePath $outputObject.ReadMePath - $outputObject.ChangeLogPath = GetRelativePath $outputObject.ChangeLogPath - Set-Content ` -Path $outputPath ` -Value (ConvertTo-Json -InputObject $outputObject -Depth 100)