Add Native AOT infrastructure for MSBuild evaluation - #55441
Merged
Conversation
|
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. |
baronfel
force-pushed
the
baronfel-aot-msbuild-evaluation
branch
from
July 24, 2026 17:49
7d2f5ec to
74cfea2
Compare
This was referenced Jul 24, 2026
baronfel
force-pushed
the
baronfel-aot-msbuild-evaluation
branch
5 times, most recently
from
July 27, 2026 21:44
5a506fa to
7e04840
Compare
Route MSBuild forwarding and workload resolver probes through SdkPaths so managed and Native AOT hosts consistently resolve the selected versioned SDK directory. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 54c93774-3a89-47a1-a53a-14dbdd71a0c8
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 54c93774-3a89-47a1-a53a-14dbdd71a0c8
baronfel
force-pushed
the
baronfel-aot-msbuild-evaluation
branch
from
July 28, 2026 14:46
7e04840 to
e54780c
Compare
Compile the existing MsbuildProject and completion paths into the Native AOT CLI so command completions can evaluate configurations and target frameworks from the current project. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 54c93774-3a89-47a1-a53a-14dbdd71a0c8
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 54c93774-3a89-47a1-a53a-14dbdd71a0c8
Add the shared workload advertising, NuGet download and signing, MSI extraction, and SDK vulnerability services to the Native AOT closure. Cover the closure directly so restoring commands can use the unchanged shared RestoringCommand as they are enabled. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 54c93774-3a89-47a1-a53a-14dbdd71a0c8
Describe static SDK resolver registration, versioned SDK path requirements, physical pack behavior, directive-free virtual evaluation, workload maintenance parity, and managed fallback boundaries. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 54c93774-3a89-47a1-a53a-14dbdd71a0c8
baronfel
force-pushed
the
baronfel-aot-msbuild-evaluation
branch
from
July 28, 2026 15:34
e54780c to
d3dde07
Compare
JeremyKuhne
requested changes
Jul 28, 2026
JeremyKuhne
left a comment
Member
There was a problem hiding this comment.
Couple of project file comments
JeremyKuhne
reviewed
Jul 28, 2026
JeremyKuhne
reviewed
Jul 28, 2026
|
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. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR lays down infrastructure for Native AOT scenarios that need consistent SDK-root probing and a reflection-free MSBuild evaluation setup, while keeping the shipping AOT entry point behavior unchanged (still defers unsupported commands to the managed CLI).
Changes:
- Centralizes versioned SDK directory resolution via
SdkPaths.SdkDirectoryand updates forwarding/resolver call sites to use it. - Introduces Native AOT-friendly MSBuild SDK resolver registration scaffolding and adds tests that validate in-process evaluation against a versioned SDK layout.
- Extracts lightweight workload advertising-manifest update/installer components (file-based + MSI) and adjusts workload record detection to use read-only Windows record access.
Reviewed changes
Copilot reviewed 45 out of 45 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/dotnet.Tests/dotnet.Tests.csproj | Excludes the new Windows-only MSI manifest installer test on non-Windows builds. |
| test/dotnet.Tests/CommandTests/Workload/Install/GivenAWindowsMsiManifestInstaller.cs | Adds focused tests for MSI manifest package ID computation (Windows-only). |
| test/dotnet.Tests/CommandTests/Workload/Install/GivenAFileBasedManifestInstaller.cs | Adds focused tests for file-based manifest installer behavior (ID computation + extraction). |
| test/dotnet-aot.Tests/WorkloadUpdateTests.cs | Adds AOT test coverage for background workload advertising updates and vulnerability cache behavior. |
| test/dotnet-aot.Tests/WorkloadInstallDetectorTests.cs | Updates detector tests to use the new read-only Windows workload record repository. |
| test/dotnet-aot.Tests/run-aot-tests.sh | Plumbs bootstrap SDK directory into AOT tests via DOTNET_AOT_TEST_SDK_DIRECTORY and exports DOTNET_HOST_PATH. |
| test/dotnet-aot.Tests/run-aot-tests.ps1 | Same as bash script, with try/finally restoring environment variables. |
| test/dotnet-aot.Tests/MSBuildEvaluationTests.cs | Adds AOT tests for resolver registration, SDK-root forwarding, and MSBuild evaluation (properties-only). |
| test/dotnet-aot.Tests/dotnet-aot.Tests.csproj | Links in AOT resolver registration source and adds resolver project reference for tests. |
| src/Resolvers/Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver/WorkloadSdkResolver.cs | Switches SDK directory probing to SdkPaths.SdkDirectory for consistent probing. |
| src/Resolvers/Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver/Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver.csproj | Links SdkPaths.cs for .NET Framework builds of the resolver. |
| src/Resolvers/Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver/CachingWorkloadResolver.cs | Uses SdkPaths.SdkDirectory for sentinel discovery instead of assembly location. |
| src/Resolvers/Microsoft.DotNet.MSBuildSdkResolver/Microsoft.DotNet.MSBuildSdkResolver.csproj | Links SdkPaths.cs into the resolver closure. |
| src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs | Uses SdkPaths.SdkDirectory for MSBuild/Sdks path wiring and MSBuildExtensionsPath. |
| src/Cli/Microsoft.DotNet.Cli.CoreUtils/SdkPaths.cs | Adds SDK directory caching + test hook, and trims trailing separators during resolution. |
| src/Cli/Microsoft.DotNet.Cli.CoreUtils/Microsoft.DotNet.Cli.CoreUtils.csproj | Expands InternalsVisibleTo to allow new call sites to use SdkPaths internals. |
| src/Cli/dotnet/MsbuildProject.cs | Removes CLI_AOT gating and fixes DOTNET_HOST_PATH restore behavior during evaluation. |
| src/Cli/dotnet/Installer/Windows/MsiPayload.cs | Switches MSI manifest JSON deserialization to a dedicated STJ source-gen context. |
| src/Cli/dotnet/Installer/Windows/MsiPackageData.cs | Extracts reusable helper for locating MSI payload via msi.json. |
| src/Cli/dotnet/Installer/Windows/MsiPackageCache.cs | Uses MsiPackageData and switches to the new JSON serializer context. |
| src/Cli/dotnet/Installer/Windows/MsiManifestJsonSerializerContext.cs | Adds dedicated STJ source-gen context for MsiManifest. |
| src/Cli/dotnet/Installer/Windows/InstallerJsonSerializerContext.cs | Removes MsiManifest from the installer message serializer context. |
| src/Cli/dotnet/dotnet.csproj | Excludes WindowsMsiManifestInstaller.cs from non-Windows builds. |
| src/Cli/dotnet/Commands/Workload/WorkloadInstallDetector.cs | Refactors file-based record location logic into a shared factory and uses read-only Windows record repo. |
| src/Cli/dotnet/Commands/Workload/WorkloadInfoHelper.cs | Reuses the shared file-based record factory and read-only Windows record repo in AOT paths. |
| src/Cli/dotnet/Commands/Workload/SIGNING-VERIFICATION.md | Updates documentation to reflect the new lightweight advertising updater construction path. |
| src/Cli/dotnet/Commands/Workload/Install/WorkloadManifestUpdater.Managed.cs | Rehomes managed implementation into a partial, delegating advertising to the extracted updater. |
| src/Cli/dotnet/Commands/Workload/Install/WorkloadManifestUpdater.cs | Leaves shared entrypoints for background advertising updates and routes to WorkloadAdvertisingManifestUpdater. |
| src/Cli/dotnet/Commands/Workload/Install/WorkloadInstallRecords/ReadOnlyWindowsWorkloadInstallationRecordRepository.cs | Introduces a read-only Windows workload record repository + reader. |
| src/Cli/dotnet/Commands/Workload/Install/WorkloadAdvertisingManifestUpdater.cs | Extracts shared advertising manifest update logic used by both managed and AOT closures. |
| src/Cli/dotnet/Commands/Workload/Install/WindowsMsiManifestInstaller.cs | Extracts MSI manifest installer logic out of the full MSI installer client for lightweight consumers. |
| src/Cli/dotnet/Commands/Workload/Install/NetSdkMsiInstallerClient.cs | Delegates manifest package ID/extraction behavior to WindowsMsiManifestInstaller. |
| src/Cli/dotnet/Commands/Workload/Install/ManifestUpdateWithWorkloads.cs | Moves the record type into its own file (no longer nested in the interface file). |
| src/Cli/dotnet/Commands/Workload/Install/IWorkloadManifestUpdater.cs | Removes the nested record definition. |
| src/Cli/dotnet/Commands/Workload/Install/IWorkloadManifestInstaller.cs | Introduces a standalone manifest installer abstraction for file/MSI implementations. |
| src/Cli/dotnet/Commands/Workload/Install/IInstaller.cs | Removes the old embedded IWorkloadManifestInstaller definition. |
| src/Cli/dotnet/Commands/Workload/Install/FileBasedManifestInstaller.cs | Extracts file-based manifest package ID and extraction behavior for lightweight consumers. |
| src/Cli/dotnet/Commands/Workload/Install/FileBasedInstaller.cs | Delegates manifest package ID/extraction behavior to FileBasedManifestInstaller. |
| src/Cli/dotnet/Commands/MSBuild/MSBuildForwardingApp.cs | Uses SdkPaths.SdkDirectory to locate dotnet.dll for telemetry logger injection. |
| src/Cli/dotnet/Commands/DotNetCommandFactory.cs | Excludes virtual/physical command creation APIs from the AOT build. |
| src/Cli/dotnet-aot/SdkRootResolution.md | Documents redist layout expectations and the unified SDK-directory probing behavior. |
| src/Cli/dotnet-aot/MSBuildSdkResolverRegistration.cs | Adds explicit registration of workload + NuGet SDK resolvers for AOT in-process evaluation. |
| src/Cli/dotnet-aot/dotnet-aot.csproj | Adjusts AOT warning severity policy and includes resolver registration source. |
| src/Cli/dotnet-aot/DESIGN.md | Updates architecture/design docs to emphasize muxer integration and MSBuild evaluation boundary. |
| src/Cli/dotnet-aot/AotSourceFiles.props | Expands the AOT closure to include resolver + advertising/vulnerability update sources and NuGet feature switch. |
Comments suppressed due to low confidence (1)
src/Cli/dotnet/Commands/Workload/Install/WorkloadAdvertisingManifestUpdater.cs:115
- The directory creation guard is inverted: this only calls Directory.CreateDirectory when the directory already exists, and skips it when it doesn't. Since Directory.CreateDirectory is idempotent, you can just call it unconditionally (or check for !Exists).
if (Directory.Exists(Path.GetDirectoryName(filePath)))
{
Directory.CreateDirectory(Path.GetDirectoryName(filePath)!);
}
File.WriteAllText(filePath, jsonContent);
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 54c93774-3a89-47a1-a53a-14dbdd71a0c8
JeremyKuhne
approved these changes
Jul 28, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 54c93774-3a89-47a1-a53a-14dbdd71a0c8
JeremyKuhne
approved these changes
Jul 28, 2026
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
SdkPaths.SdkDirectoryso the managed and Native AOT CLIs, forwarding apps, and SDK resolvers use the same probing logic.AotSourceFiles.propslimited to source/resource inputs, with shared dependencies and runtime configuration inAotDependencies.props.This is the infrastructure layer of a two-PR stack. It deliberately does not call
MSBuildSdkResolverRegistration.Register()during Native AOT startup and does not enable any additional MSBuild-backed commands. Unsupported commands continue to fall through to the managed CLI, so the resolver/evaluation closure is not activated in the shipping native image by this PR.Validation
dotnet-aot.csprojbuilds with no warnings or errors.dotnet.csprojbuilds with no warnings or errors.TrimmerSingleWarn=false.