Skip to content

Replace nuget-verification with dotnet nuget verify using InitializeDotNetCli#16354

Merged
akoeplinger merged 4 commits intomainfrom
copilot/replace-nuget-verification
Dec 4, 2025
Merged

Replace nuget-verification with dotnet nuget verify using InitializeDotNetCli#16354
akoeplinger merged 4 commits intomainfrom
copilot/replace-nuget-verification

Conversation

Copy link
Contributor

Copilot AI commented Nov 24, 2025

The nuget-verification.ps1 script was failing in post-build validation because it attempted to use the SDK version from global.json which wasn't available in that context. The script was also unnecessarily complex, downloading nuget.exe and the NuGet.VerifyMicrosoftPackage tool.

Changes:

  • Replace the entire download/install logic with InitializeDotNetCli -install:$true which ensures the correct SDK is available
  • Use dotnet nuget verify directly instead of the external verification tool
  • Remove nuget-validation.ps1 and integrate its logic into nuget-verification.ps1:
    • Accept PackagesPath parameter directly
    • Use Get-ChildItem to find all *.nupkg files
    • Include pipeline telemetry error logging with try/catch
  • Update post-build.yml to reference nuget-verification.ps1 directly
# Before: Downloaded nuget.exe, fetched NuGet.VerifyMicrosoftPackage, ran external tool via wrapper script
# After:
$dotnetRoot = InitializeDotNetCli -install:$true
$dotnet = Join-Path $dotnetRoot (GetExecutableFileName 'dotnet')
$packageFiles = Get-ChildItem -Path $PackagesPath -Filter '*.nupkg' -File
& $dotnet nuget verify $packagePaths

To double check:

Original prompt

This section details on the original issue you should resolve

<issue_title>replace nuget-vefirication that downloads nuget and package with dotnet nuget verify</issue_title>
<issue_description>- [ ] This issue is blocking

  • This issue is causing unreasonable pain

https://github.com/dotnet/arcade/blame/00d4b9b955b4b67d20221a490df91783ce2b7b0d/eng/common/post-build/nuget-verification.ps1#L40

This whole script (except for the checking of exit code) seems to be easily replaced by call to dotnet nuget verify.

Except that this is a net10 thing global.json that is set by arcade applies, and the Nuget Verify step does not have net10 available.

From build:

The command could not be loaded, possibly because:
  * You intended to execute a .NET application:
      The application 'nuget' does not exist.
  * You intended to execute a .NET SDK command:
      A compatible .NET SDK was not found.

Requested SDK version: 10.0.100-preview.7.25372.107
global.json file: D:\a\_work\1\s\global.json

Installed SDKs:

Install the [10.0.100-preview.7.25372.107] .NET SDK or update [D:\a\_work\1\s\global.json] to match an installed SDK.

Learn about SDK resolution:
https://aka.ms/dotnet/sdk-not-found
9.0.304 [C:\Program Files\dotnet\sdk]
at <ScriptBlock>, D:\a\_work\1\s\eng\common\post-build\nuget-verification.ps1: line 7
at <ScriptBlock>, D:\a\_work\1\s\eng\common\post-build\nuget-validation.ps1: line 16
at <ScriptBlock>, D:\a\_work\_temp\5b8f4b8b-dfca-4c5e-a29c-e04b4f5cf039.ps1: line 4
at <ScriptBlock>, <No file>: line 1

</issue_description>

Comments on the Issue (you are @copilot in this section)

@mmitche The right way to do this is to initialize the cli first, using `eng/comon/tools.ps1/sh` and then calling `InitializeDotNetCli`. Then the `DOTNET_INSTALL_DIR` will point to the required installation.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Replace NuGet verification script with dotnet nuget verify Replace nuget-verification with dotnet nuget verify using InitializeDotNetCli Nov 24, 2025
Copilot AI requested a review from mmitche November 24, 2025 23:04
@akoeplinger akoeplinger marked this pull request as ready for review November 28, 2025 11:57
@mmitche
Copy link
Member

mmitche commented Dec 1, 2025

We'll need another reviewer since I don't count and you're the last pusher :)

@akoeplinger akoeplinger enabled auto-merge (squash) December 3, 2025 10:26
@akoeplinger akoeplinger merged commit 868625e into main Dec 4, 2025
10 checks passed
@akoeplinger akoeplinger deleted the copilot/replace-nuget-verification branch December 4, 2025 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

replace nuget-vefirication that downloads nuget and package with dotnet nuget verify

4 participants