Skip to content

Commit d2bb4b2

Browse files
authored
Specify a versions of NuGet packages without using a temporary file (#6566)
1 parent 9f1e72d commit d2bb4b2

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

Build/NuGet/package.ps1

+1-17
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,13 @@ If (!(Test-Path $targetNugetExe))
2222

2323
Write-Host "NuGet.exe not found - downloading latest from $sourceNugetExe"
2424

25-
$sourceNugetExe = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
26-
2725
Invoke-WebRequest $sourceNugetExe -OutFile $targetNugetExe
2826
}
2927

3028
$versionStr = (Get-Content $packageVersionFile)
3129

32-
Write-Host "Setting .nuspec version tag to $versionStr"
33-
34-
$compiledNuspec = "$root\nuget\compiled.nuspec"
35-
3630
# Create new packages for any nuspec files that exist in this directory.
3731
Foreach ($nuspec in $(Get-Item $packageRoot\*.nuspec))
3832
{
39-
$content = (Get-Content $nuspec)
40-
$content = $content -replace '\$version\$',$versionStr
41-
$content | Out-File $compiledNuspec
42-
43-
& $targetNugetExe pack $compiledNuspec -outputdirectory $packageArtifacts
44-
}
45-
46-
# Delete compiled temporary nuspec.
47-
If (Test-Path $compiledNuspec)
48-
{
49-
Remove-Item $compiledNuspec
33+
& $targetNugetExe pack $nuspec -outputdirectory $packageArtifacts -properties version=$versionStr
5034
}

0 commit comments

Comments
 (0)