From 618b29d423768501e1ea863aa3cd4c1fc26a31a0 Mon Sep 17 00:00:00 2001 From: Andrey Tretyak Date: Mon, 6 Apr 2026 18:00:41 -0700 Subject: [PATCH 1/5] Remove usage of old NuGet tools --- init.ps1 | 14 +++++++------- tools/Convert-PDB.ps1 | 5 ++--- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/init.ps1 b/init.ps1 index 8bb78ad8..9c62b5e7 100755 --- a/init.ps1 +++ b/init.ps1 @@ -126,40 +126,40 @@ try { } } - $InstallNuGetPkgScriptPath = "$PSScriptRoot\tools\Install-NuGetPackage.ps1" + $DownloadNuGetPkgScriptPath = "$PSScriptRoot\tools\Download-NuGetPackage.ps1" $nugetVerbosity = 'quiet' if ($Verbose) { $nugetVerbosity = 'normal' } $MicroBuildPackageSource = 'https://pkgs.dev.azure.com/devdiv/_packaging/MicroBuildToolset%40Local/nuget/v3/index.json' if ($Signing) { Write-Host "Installing MicroBuild signing plugin" -ForegroundColor $HeaderColor - & $InstallNuGetPkgScriptPath MicroBuild.Plugins.Signing -source $MicroBuildPackageSource -Verbosity $nugetVerbosity + & $DownloadNuGetPkgScriptPath -PackageId MicroBuild.Plugins.Signing -Source $MicroBuildPackageSource -Verbosity $nugetVerbosity $EnvVars['SignType'] = "Test" } if ($Setup) { Write-Host "Installing MicroBuild SwixBuild plugin..." -ForegroundColor $HeaderColor - & $InstallNuGetPkgScriptPath Microsoft.VisualStudioEng.MicroBuild.Plugins.SwixBuild -source $MicroBuildPackageSource -Verbosity $nugetVerbosity + & $DownloadNuGetPkgScriptPath -PackageId Microsoft.VisualStudioEng.MicroBuild.Plugins.SwixBuild -Source $MicroBuildPackageSource -Verbosity $nugetVerbosity } if ($OptProf) { Write-Host "Installing MicroBuild OptProf plugin" -ForegroundColor $HeaderColor - & $InstallNuGetPkgScriptPath MicroBuild.Plugins.OptProf -source $MicroBuildPackageSource -Verbosity $nugetVerbosity + & $DownloadNuGetPkgScriptPath -PackageId MicroBuild.Plugins.OptProf -Source $MicroBuildPackageSource -Verbosity $nugetVerbosity $EnvVars['OptProfEnabled'] = '1' } if ($Localization) { Write-Host "Installing MicroBuild localization plugin" -ForegroundColor $HeaderColor - & $InstallNuGetPkgScriptPath MicroBuild.Plugins.Localization -source $MicroBuildPackageSource -Verbosity $nugetVerbosity + & $DownloadNuGetPkgScriptPath -PackageId MicroBuild.Plugins.Localization -Source $MicroBuildPackageSource -Verbosity $nugetVerbosity $EnvVars['LocType'] = "Pseudo" $EnvVars['LocLanguages'] = "JPN" } if ($SBOM) { Write-Host "Installing MicroBuild SBOM plugin" -ForegroundColor $HeaderColor - & $InstallNuGetPkgScriptPath MicroBuild.Plugins.Sbom -source $MicroBuildPackageSource -Verbosity $nugetVerbosity + & $DownloadNuGetPkgScriptPath -PackageId MicroBuild.Plugins.Sbom -Source $MicroBuildPackageSource -Verbosity $nugetVerbosity # The feed with the latest versions of the tool is at 'https://1essharedassets.pkgs.visualstudio.com/1esPkgs/_packaging/SBOMTool/nuget/v3/index.json', # but we'll use the feed that the SBOM task itself uses to install the tool for consistency. - $PkgMicrosoft_ManifestTool_CrossPlatform = & $InstallNuGetPkgScriptPath Microsoft.ManifestTool.CrossPlatform -source $MicroBuildPackageSource -Verbosity $nugetVerbosity + $PkgMicrosoft_ManifestTool_CrossPlatform = & $DownloadNuGetPkgScriptPath -PackageId Microsoft.ManifestTool.CrossPlatform -Source $MicroBuildPackageSource -Verbosity $nugetVerbosity $EnvVars['GenerateSBOM'] = "true" $EnvVars['PkgMicrosoft_ManifestTool_CrossPlatform'] = $PkgMicrosoft_ManifestTool_CrossPlatform } diff --git a/tools/Convert-PDB.ps1 b/tools/Convert-PDB.ps1 index 7e1303a2..cb295e5d 100644 --- a/tools/Convert-PDB.ps1 +++ b/tools/Convert-PDB.ps1 @@ -25,14 +25,13 @@ if ($IsMacOS -or $IsLinux) { $version = '1.1.0-beta2-21101-01' $baseDir = "$PSScriptRoot/../obj/tools" -$pdb2pdbpath = "$baseDir/Microsoft.DiaSymReader.Pdb2Pdb.$version/tools/Pdb2Pdb.exe" +$pdb2pdbpath = "$baseDir/Microsoft.DiaSymReader.Pdb2Pdb/$version/tools/Pdb2Pdb.exe" if (-not (Test-Path $pdb2pdbpath)) { if (-not (Test-Path $baseDir)) { New-Item -Type Directory -Path $baseDir | Out-Null } $baseDir = (Resolve-Path $baseDir).Path # Normalize it - 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" # This package originally comes from the https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json feed. # Add this feed as an upstream to whatever feed is in nuget.config if this step fails. - & (& $PSScriptRoot/Get-NuGetTool.ps1) install Microsoft.DiaSymReader.Pdb2Pdb -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir | Out-Null + & "$PSScriptRoot/Download-NuGetPackage.ps1" -PackageId Microsoft.DiaSymReader.Pdb2Pdb -Version $version -OutputDirectory $baseDir | Out-Null if ($LASTEXITCODE -ne 0) { 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." return From 251d36773a8aa2b9c69ea8a6142d2c9a4c2aa4d7 Mon Sep 17 00:00:00 2001 From: Andrey Tretyak Date: Mon, 6 Apr 2026 23:33:21 -0700 Subject: [PATCH 2/5] Add source for procdump package --- tools/Get-ProcDump.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/Get-ProcDump.ps1 b/tools/Get-ProcDump.ps1 index 8b1f7d1e..d769516c 100644 --- a/tools/Get-ProcDump.ps1 +++ b/tools/Get-ProcDump.ps1 @@ -6,7 +6,7 @@ $version = '0.0.1' $baseDir = "$PSScriptRoot\..\obj\tools" $procDumpToolPath = "$baseDir\procdump\$version\bin" if (-not (Test-Path $procDumpToolPath)) { - & "$PSScriptRoot\Download-NuGetPackage.ps1" -PackageId procdump -Version $version -OutputDirectory $baseDir | Out-Null + & "$PSScriptRoot\Download-NuGetPackage.ps1" -PackageId procdump -Version $version -Source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json -OutputDirectory $baseDir | Out-Null } (Resolve-Path $procDumpToolPath).Path From 5ac7e6394235a120c28d0d5cf5b4c39e4c93365a Mon Sep 17 00:00:00 2001 From: Andrey Tretyak Date: Tue, 7 Apr 2026 10:07:53 -0700 Subject: [PATCH 3/5] Add feed for getting Microsoft.DiaSymReader.Pdb2Pdb --- tools/Convert-PDB.ps1 | 10 +++++----- tools/Get-ProcDump.ps1 | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/Convert-PDB.ps1 b/tools/Convert-PDB.ps1 index cb295e5d..a0640e87 100644 --- a/tools/Convert-PDB.ps1 +++ b/tools/Convert-PDB.ps1 @@ -10,11 +10,11 @@ #> [CmdletBinding()] Param( - [Parameter(Mandatory=$true,Position=0)] + [Parameter(Mandatory = $true, Position = 0)] [string]$DllPath, [Parameter()] [string]$PdbPath, - [Parameter(Mandatory=$true,Position=1)] + [Parameter(Mandatory = $true, Position = 1)] [string]$OutputPath ) @@ -31,16 +31,16 @@ if (-not (Test-Path $pdb2pdbpath)) { $baseDir = (Resolve-Path $baseDir).Path # Normalize it # This package originally comes from the https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json feed. # Add this feed as an upstream to whatever feed is in nuget.config if this step fails. - & "$PSScriptRoot/Download-NuGetPackage.ps1" -PackageId Microsoft.DiaSymReader.Pdb2Pdb -Version $version -OutputDirectory $baseDir | Out-Null + & "$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 if ($LASTEXITCODE -ne 0) { 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." return } } -$args = $DllPath,'/out',$OutputPath,'/nowarn','0021' +$args = $DllPath, '/out', $OutputPath, '/nowarn', '0021' if ($PdbPath) { - $args += '/pdb',$PdbPath + $args += '/pdb', $PdbPath } Write-Verbose "$pdb2pdbpath $args" diff --git a/tools/Get-ProcDump.ps1 b/tools/Get-ProcDump.ps1 index d769516c..8b1f7d1e 100644 --- a/tools/Get-ProcDump.ps1 +++ b/tools/Get-ProcDump.ps1 @@ -6,7 +6,7 @@ $version = '0.0.1' $baseDir = "$PSScriptRoot\..\obj\tools" $procDumpToolPath = "$baseDir\procdump\$version\bin" if (-not (Test-Path $procDumpToolPath)) { - & "$PSScriptRoot\Download-NuGetPackage.ps1" -PackageId procdump -Version $version -Source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json -OutputDirectory $baseDir | Out-Null + & "$PSScriptRoot\Download-NuGetPackage.ps1" -PackageId procdump -Version $version -OutputDirectory $baseDir | Out-Null } (Resolve-Path $procDumpToolPath).Path From 765e11ce0b342bbf2c4ae93052d254027ccfcad1 Mon Sep 17 00:00:00 2001 From: Andrey Tretyak Date: Tue, 7 Apr 2026 10:20:45 -0700 Subject: [PATCH 4/5] try Copilot suggested fixes --- tools/Convert-PDB.ps1 | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tools/Convert-PDB.ps1 b/tools/Convert-PDB.ps1 index a0640e87..ad007996 100644 --- a/tools/Convert-PDB.ps1 +++ b/tools/Convert-PDB.ps1 @@ -25,23 +25,26 @@ if ($IsMacOS -or $IsLinux) { $version = '1.1.0-beta2-21101-01' $baseDir = "$PSScriptRoot/../obj/tools" -$pdb2pdbpath = "$baseDir/Microsoft.DiaSymReader.Pdb2Pdb/$version/tools/Pdb2Pdb.exe" +$pdb2pdbpath = "$baseDir/microsoft.diasymreader.pdb2pdb/$version/tools/Pdb2Pdb.exe" if (-not (Test-Path $pdb2pdbpath)) { if (-not (Test-Path $baseDir)) { New-Item -Type Directory -Path $baseDir | Out-Null } $baseDir = (Resolve-Path $baseDir).Path # Normalize it # This package originally comes from the https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json feed. # Add this feed as an upstream to whatever feed is in nuget.config if this step fails. - & "$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 - if ($LASTEXITCODE -ne 0) { + try { + & "$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 + } + catch { 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." return } + $pdb2pdbpath = "$baseDir/microsoft.diasymreader.pdb2pdb/$version/tools/Pdb2Pdb.exe" } -$args = $DllPath, '/out', $OutputPath, '/nowarn', '0021' +$arguments = $DllPath, '/out', $OutputPath, '/nowarn', '0021' if ($PdbPath) { - $args += '/pdb', $PdbPath + $arguments += '/pdb', $PdbPath } -Write-Verbose "$pdb2pdbpath $args" -& $pdb2pdbpath $args +Write-Verbose "$pdb2pdbpath $arguments" +& $pdb2pdbpath $arguments From 6fdb900be3e23a6766019dc27552a8670b927a80 Mon Sep 17 00:00:00 2001 From: Andrey Tretyak Date: Tue, 7 Apr 2026 10:34:24 -0700 Subject: [PATCH 5/5] Add pre-release support --- tools/Download-NuGetPackage.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/Download-NuGetPackage.ps1 b/tools/Download-NuGetPackage.ps1 index 924b9edf..ce31167a 100644 --- a/tools/Download-NuGetPackage.ps1 +++ b/tools/Download-NuGetPackage.ps1 @@ -42,14 +42,16 @@ if ($Version) { $packageArg = "$PackageId@$Version" } $extraArgs = @() if ($Source) { $extraArgs += '--source', $Source } +if ($Version -and $Version -match '-') { $extraArgs += '--prerelease' } $prevErrorActionPreference = $ErrorActionPreference $ErrorActionPreference = 'Continue' -& dotnet package download $packageArg --configfile $ConfigFile --output $OutputDirectory --verbosity $Verbosity @extraArgs 2>&1 | Out-Null +$downloadOutput = & dotnet package download $packageArg --configfile $ConfigFile --output $OutputDirectory --verbosity $Verbosity @extraArgs 2>&1 $downloadExitCode = $LASTEXITCODE $ErrorActionPreference = $prevErrorActionPreference if ($downloadExitCode -ne 0) { + $downloadOutput | Write-Host throw "Failed to download package $packageArg (exit code $downloadExitCode)." }