Skip to content

Commit 58c98c4

Browse files
Remove usage of old NuGet tools (#496)
* Remove usage of old NuGet tools * Add source for procdump package * Add feed for getting Microsoft.DiaSymReader.Pdb2Pdb * try Copilot suggested fixes * Add pre-release support
1 parent 84648ad commit 58c98c4

3 files changed

Lines changed: 22 additions & 18 deletions

File tree

init.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,40 +126,40 @@ try {
126126
}
127127
}
128128

129-
$InstallNuGetPkgScriptPath = "$PSScriptRoot\tools\Install-NuGetPackage.ps1"
129+
$DownloadNuGetPkgScriptPath = "$PSScriptRoot\tools\Download-NuGetPackage.ps1"
130130
$nugetVerbosity = 'quiet'
131131
if ($Verbose) { $nugetVerbosity = 'normal' }
132132
$MicroBuildPackageSource = 'https://pkgs.dev.azure.com/devdiv/_packaging/MicroBuildToolset%40Local/nuget/v3/index.json'
133133
if ($Signing) {
134134
Write-Host "Installing MicroBuild signing plugin" -ForegroundColor $HeaderColor
135-
& $InstallNuGetPkgScriptPath MicroBuild.Plugins.Signing -source $MicroBuildPackageSource -Verbosity $nugetVerbosity
135+
& $DownloadNuGetPkgScriptPath -PackageId MicroBuild.Plugins.Signing -Source $MicroBuildPackageSource -Verbosity $nugetVerbosity
136136
$EnvVars['SignType'] = "Test"
137137
}
138138

139139
if ($Setup) {
140140
Write-Host "Installing MicroBuild SwixBuild plugin..." -ForegroundColor $HeaderColor
141-
& $InstallNuGetPkgScriptPath Microsoft.VisualStudioEng.MicroBuild.Plugins.SwixBuild -source $MicroBuildPackageSource -Verbosity $nugetVerbosity
141+
& $DownloadNuGetPkgScriptPath -PackageId Microsoft.VisualStudioEng.MicroBuild.Plugins.SwixBuild -Source $MicroBuildPackageSource -Verbosity $nugetVerbosity
142142
}
143143

144144
if ($OptProf) {
145145
Write-Host "Installing MicroBuild OptProf plugin" -ForegroundColor $HeaderColor
146-
& $InstallNuGetPkgScriptPath MicroBuild.Plugins.OptProf -source $MicroBuildPackageSource -Verbosity $nugetVerbosity
146+
& $DownloadNuGetPkgScriptPath -PackageId MicroBuild.Plugins.OptProf -Source $MicroBuildPackageSource -Verbosity $nugetVerbosity
147147
$EnvVars['OptProfEnabled'] = '1'
148148
}
149149

150150
if ($Localization) {
151151
Write-Host "Installing MicroBuild localization plugin" -ForegroundColor $HeaderColor
152-
& $InstallNuGetPkgScriptPath MicroBuild.Plugins.Localization -source $MicroBuildPackageSource -Verbosity $nugetVerbosity
152+
& $DownloadNuGetPkgScriptPath -PackageId MicroBuild.Plugins.Localization -Source $MicroBuildPackageSource -Verbosity $nugetVerbosity
153153
$EnvVars['LocType'] = "Pseudo"
154154
$EnvVars['LocLanguages'] = "JPN"
155155
}
156156

157157
if ($SBOM) {
158158
Write-Host "Installing MicroBuild SBOM plugin" -ForegroundColor $HeaderColor
159-
& $InstallNuGetPkgScriptPath MicroBuild.Plugins.Sbom -source $MicroBuildPackageSource -Verbosity $nugetVerbosity
159+
& $DownloadNuGetPkgScriptPath -PackageId MicroBuild.Plugins.Sbom -Source $MicroBuildPackageSource -Verbosity $nugetVerbosity
160160
# The feed with the latest versions of the tool is at 'https://1essharedassets.pkgs.visualstudio.com/1esPkgs/_packaging/SBOMTool/nuget/v3/index.json',
161161
# but we'll use the feed that the SBOM task itself uses to install the tool for consistency.
162-
$PkgMicrosoft_ManifestTool_CrossPlatform = & $InstallNuGetPkgScriptPath Microsoft.ManifestTool.CrossPlatform -source $MicroBuildPackageSource -Verbosity $nugetVerbosity
162+
$PkgMicrosoft_ManifestTool_CrossPlatform = & $DownloadNuGetPkgScriptPath -PackageId Microsoft.ManifestTool.CrossPlatform -Source $MicroBuildPackageSource -Verbosity $nugetVerbosity
163163
$EnvVars['GenerateSBOM'] = "true"
164164
$EnvVars['PkgMicrosoft_ManifestTool_CrossPlatform'] = $PkgMicrosoft_ManifestTool_CrossPlatform
165165
}

tools/Convert-PDB.ps1

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
#>
1111
[CmdletBinding()]
1212
Param(
13-
[Parameter(Mandatory=$true,Position=0)]
13+
[Parameter(Mandatory = $true, Position = 0)]
1414
[string]$DllPath,
1515
[Parameter()]
1616
[string]$PdbPath,
17-
[Parameter(Mandatory=$true,Position=1)]
17+
[Parameter(Mandatory = $true, Position = 1)]
1818
[string]$OutputPath
1919
)
2020

@@ -25,24 +25,26 @@ if ($IsMacOS -or $IsLinux) {
2525

2626
$version = '1.1.0-beta2-21101-01'
2727
$baseDir = "$PSScriptRoot/../obj/tools"
28-
$pdb2pdbpath = "$baseDir/Microsoft.DiaSymReader.Pdb2Pdb.$version/tools/Pdb2Pdb.exe"
28+
$pdb2pdbpath = "$baseDir/microsoft.diasymreader.pdb2pdb/$version/tools/Pdb2Pdb.exe"
2929
if (-not (Test-Path $pdb2pdbpath)) {
3030
if (-not (Test-Path $baseDir)) { New-Item -Type Directory -Path $baseDir | Out-Null }
3131
$baseDir = (Resolve-Path $baseDir).Path # Normalize it
32-
Write-Verbose "& (& $PSScriptRoot/Get-NuGetTool.ps1) install Microsoft.DiaSymReader.Pdb2Pdb -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir -Source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json | Out-Null"
3332
# This package originally comes from the https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json feed.
3433
# Add this feed as an upstream to whatever feed is in nuget.config if this step fails.
35-
& (& $PSScriptRoot/Get-NuGetTool.ps1) install Microsoft.DiaSymReader.Pdb2Pdb -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir | Out-Null
36-
if ($LASTEXITCODE -ne 0) {
34+
try {
35+
& "$PSScriptRoot/Download-NuGetPackage.ps1" -PackageId Microsoft.DiaSymReader.Pdb2Pdb -Version $version -Source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json -OutputDirectory $baseDir | Out-Null
36+
}
37+
catch {
3738
Write-Error "Failed to install Microsoft.DiaSymReader.Pdb2Pdb. Consider adding https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json as an upstream to your nuget.config feed."
3839
return
3940
}
41+
$pdb2pdbpath = "$baseDir/microsoft.diasymreader.pdb2pdb/$version/tools/Pdb2Pdb.exe"
4042
}
4143

42-
$args = $DllPath,'/out',$OutputPath,'/nowarn','0021'
44+
$arguments = $DllPath, '/out', $OutputPath, '/nowarn', '0021'
4345
if ($PdbPath) {
44-
$args += '/pdb',$PdbPath
46+
$arguments += '/pdb', $PdbPath
4547
}
4648

47-
Write-Verbose "$pdb2pdbpath $args"
48-
& $pdb2pdbpath $args
49+
Write-Verbose "$pdb2pdbpath $arguments"
50+
& $pdb2pdbpath $arguments

tools/Download-NuGetPackage.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,16 @@ if ($Version) { $packageArg = "$PackageId@$Version" }
4242

4343
$extraArgs = @()
4444
if ($Source) { $extraArgs += '--source', $Source }
45+
if ($Version -and $Version -match '-') { $extraArgs += '--prerelease' }
4546

4647
$prevErrorActionPreference = $ErrorActionPreference
4748
$ErrorActionPreference = 'Continue'
48-
& dotnet package download $packageArg --configfile $ConfigFile --output $OutputDirectory --verbosity $Verbosity @extraArgs 2>&1 | Out-Null
49+
$downloadOutput = & dotnet package download $packageArg --configfile $ConfigFile --output $OutputDirectory --verbosity $Verbosity @extraArgs 2>&1
4950
$downloadExitCode = $LASTEXITCODE
5051
$ErrorActionPreference = $prevErrorActionPreference
5152

5253
if ($downloadExitCode -ne 0) {
54+
$downloadOutput | Write-Host
5355
throw "Failed to download package $packageArg (exit code $downloadExitCode)."
5456
}
5557

0 commit comments

Comments
 (0)