Fix Native AOT SDK version lookup#55410
Merged
baronfel merged 1 commit intoJul 22, 2026
Merged
Conversation
Resolve the SDK .version file through SdkPaths so Product.Version works when the Native AOT CLI is loaded by the muxer. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9c278b1d-69fa-4a23-be2f-d35ae29622a1
|
Azure Pipelines: Successfully started running 2 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Member
Author
|
Once merged we'll want to backport to SDK main as well so that future release versions pick this up. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes SDK version resolution in the Native AOT CLI host by ensuring the .version file is resolved from the resolved versioned SDK directory (SdkPaths.SdkDirectory) rather than from AppContext.BaseDirectory, which can point at the install root in separated Native AOT layouts.
Changes:
- Update
.versionfile discovery to useSdkPaths.SdkDirectory, makingProduct.Version/--versioncorrect in both managed and Native AOT hosts. - Add
InternalsVisibleToforMicrosoft.DotNet.Cli.CoreUtilssoSdkPathscan be shared withdotnet,dotnet-aot, anddotnet-aot.Tests. - Extend the separated-layout AOT integration test to validate
--versionreads the synthetic.versionvalue from the resolved SDK directory.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/dotnet-aot.Tests/AotIntegrationTests.cs | Adds an end-to-end assertion that dn --version uses the .version file from the resolved separated SDK directory. |
| src/Cli/Microsoft.DotNet.Cli.CoreUtils/SdkPaths.cs | Updates comments to reflect CoreUtils location and clarifies Native AOT resolution behavior. |
| src/Cli/Microsoft.DotNet.Cli.CoreUtils/Microsoft.DotNet.Cli.CoreUtils.csproj | Grants friend access to internals for dotnet, dotnet-aot, and dotnet-aot.Tests. |
| src/Cli/Microsoft.DotNet.Cli.CoreUtils/DotnetFiles.cs | Resolves .version from SdkPaths.SdkDirectory instead of AppContext.BaseDirectory. |
| .github/skills/add-dotnet-aot-command/SKILL.md | Updates guidance to reference SdkPaths being in Microsoft.DotNet.Cli.CoreUtils. |
mthalman
approved these changes
Jul 22, 2026
baronfel
enabled auto-merge (squash)
July 22, 2026 15:25
Member
Author
|
/backport to main |
Contributor
|
Started backporting to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SdkPathsinto CoreUtils soDotnetFilescan use it without reversing the existing project dependency.versionfile fromSdkPaths.SdkDirectory, makingProduct.Versioncorrect in both managed and Native AOT hostsFixes dotnet/dotnet#7901
Testing
dotnet build src/Cli/Microsoft.DotNet.Cli.CoreUtils/Microsoft.DotNet.Cli.CoreUtils.csproj -c Debugdotnet build test/dotnet-aot.Tests/dotnet-aot.Tests.csproj -c Debugdn --versionagainst a separated SDK layout with a synthetic.versionfile