Skip to content

Restore aggregate ASP.NET Core tool executables - #7131

Merged
DamianEdwards merged 7 commits into
mainfrom
damianedwards/restore-pr-7020-fix
Jun 16, 2026
Merged

DamianEdwards merged 7 commits into
mainfrom
damianedwards/restore-pr-7020-fix

Conversation

@DamianEdwards

Copy link
Copy Markdown
Member

Re-lands the aggregate ASP.NET Core tool executable changes from #7020 after the revert in #7124.

#7124 identified Windows ILC SourceLinkWriter file-lock failures caused by overlapping NativeAOT publishes writing the same aspnetcoretools.sourcelink intermediate. This re-land keeps the aggregate executable layout, but gives the test-triggered aggregate publish its own NativeIntermediateOutputPath so it cannot race with the product publish on the same SourceLink/intermediate files.

Validation performed locally on Windows:

  • Restored and published src\aspnetcore\src\Tools\NativeAot\aspnetcoretools\aspnetcoretools.csproj for win-x64.
  • Ran PublishNativeAotToolsForTests on src\aspnetcore\src\Tools\NativeAot\test\Microsoft.AspNetCore.Tools.NativeAot.Tests.csproj for win-x64.
  • Confirmed the product and test publishes now produce distinct aspnetcoretools.sourcelink paths under separate artifacts\obj directories.

Note: the full documented ASP.NET Core eng\build.cmd path is currently blocked before reaching these projects by an unrelated GenerateFiles task/package mismatch where the resolved Microsoft.DotNet.Build.Tasks.Templating task does not expose the SkipUnchanged parameter used by source.

Re-land the aggregate ASP.NET Core tool executable layout from #7020 and isolate the NativeAOT test publish intermediates so Windows product and test publishes do not race on aspnetcoretools.sourcelink.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings June 8, 2026 22:06
@dotnet-policy-service
dotnet-policy-service Bot requested review from a team June 8, 2026 22:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR re-lands the “aggregate ASP.NET Core tool executables” layout so the SDK can resolve dotnet dev-certs, dotnet user-jwts, and dotnet user-secrets from a single aggregated tool package (aspnetcoretools), while avoiding the Windows NativeAOT SourceLink intermediate file-lock race by isolating test-triggered publish intermediates.

Changes:

  • Update SDK tool layout + resolution to use the aspnetcoretools aggregate package for the ASP.NET Core bundled tools (non-source-only builds).
  • Add/enable the new aspnetcoretools.csproj aggregate tool project and wire it into ASP.NET Core solution/build inputs.
  • Prevent test-triggered NativeAOT publishes from racing with product publishes by using a dedicated NativeIntermediateOutputPath for tests and updating test helper expectations to the new publish layout.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/sdk/test/dotnet.Tests/CommandFactoryTests/GivenADotnetToolsCommandResolver.cs Adds a test ensuring aggregated tool package layout resolves executables correctly.
src/sdk/src/Layout/redist/targets/BundledDotnetTools.targets Switches bundled tool restore/layout to aspnetcoretools for non-source-only builds; keeps individual tool packages for source-only.
src/sdk/src/Cli/dotnet/CommandFactory/CommandResolution/DotnetToolsCommandResolver.cs Adds fallback mapping so dotnet-dev-certs, dotnet-user-jwts, and dotnet-user-secrets resolve from aspnetcoretools when their direct folders aren’t present.
src/aspnetcore/src/Tools/Tools.slnf Includes the new aggregate tool project in the tools solution filter.
src/aspnetcore/src/Tools/Shared/TestHelpers/NativeAotToolRunner.cs Updates test helper to locate published executables under the aggregated nativeaot-tools layout.
src/aspnetcore/src/Tools/NativeAot/test/Microsoft.AspNetCore.Tools.NativeAot.Tests.csproj Publishes aggregate tools for tests with an isolated NativeAOT intermediate path to prevent Windows file-lock races.
src/aspnetcore/src/Tools/NativeAot/aspnetcoretools/aspnetcoretools.csproj Adds the aggregate tool project that produces the combined tool executables.
src/aspnetcore/src/Tools/NativeAot/AspNetCoreTools.NativeAot.props Centralizes NativeAOT publish settings used by the aggregate and individual tool projects.
src/aspnetcore/src/Tools/dotnet-user-secrets/src/dotnet-user-secrets.csproj Aligns RID settings for product builds and imports shared NativeAOT publish settings.
src/aspnetcore/src/Tools/dotnet-user-jwts/src/dotnet-user-jwts.csproj Aligns RID settings for product builds and imports shared NativeAOT publish settings.
src/aspnetcore/src/Tools/dotnet-dev-certs/src/dotnet-dev-certs.csproj Aligns RID settings for product builds and imports shared NativeAOT publish settings.
src/aspnetcore/src/Tools/Directory.Build.targets Removes NativeAOT publish property defaults (moved into the new shared props file).
src/aspnetcore/eng/Build.props Ensures the aggregate tool project is included/excluded appropriately in build project lists/subsets.
src/aspnetcore/AspNetCore.slnx Adds the new aggregate tool project to the solution.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@DamianEdwards
DamianEdwards requested a review from lewing June 8, 2026 22:28
DamianEdwards and others added 2 commits June 8, 2026 15:33
Address review feedback by using the SDK test infrastructure to create the temporary DotnetTools layout instead of manually deleting an ad-hoc temp path.

Co-authored-by: Copilot <[email protected]>
Address review feedback by guarding temp directory cleanup and ignoring cleanup failures without requiring SdkTest redist setup.

Co-authored-by: Copilot <[email protected]>
Build the aggregate ASP.NET Core tool publish output as part of the aggregate project build, then make the NativeAOT tests consume that product output through a sequencing ProjectReference instead of running a second publish.

Co-authored-by: Copilot <[email protected]>
Set _IsPublishing statically so Build and Publish share the same project instance, and default RuntimeIdentifier when NativeAOT publish is enabled. This avoids re-entering aspnetcoretools with global properties while keeping the test project's publish dependency deterministic.

Co-authored-by: Copilot <[email protected]>
@DamianEdwards

Copy link
Copy Markdown
Member Author

@lewing ready for your review

Depend on the SDK core publish targets from the build hook instead of the Publish target itself. This keeps the publish work in the same project instance while avoiding the Publish -> Build -> after-Build -> Publish cycle.

Co-authored-by: Copilot <[email protected]>

@wtgodbe wtgodbe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aspnetcore part LGTM

@lewing lewing left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good me, you could do an official build if you wanted to be 100% sure

@DamianEdwards

Copy link
Copy Markdown
Member Author

/azp run dotnet-unified-build-full

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@dsplaisted

Copy link
Copy Markdown
Member

@DamianEdwards FYI I've added guidance to cover how to handle this to dotnet/skills: dotnet/skills#770

@dotnet-policy-service
dotnet-policy-service Bot requested review from a team June 16, 2026 16:32
@DamianEdwards
DamianEdwards enabled auto-merge (squash) June 16, 2026 16:53
@DamianEdwards

Copy link
Copy Markdown
Member Author

@wtgodbe can I get another approval after the merge to fix the conflict pls?

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.

5 participants