Enable MSBuild-backed commands in the Native AOT CLI#55441
Draft
baronfel wants to merge 13 commits into
Draft
Conversation
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
Register workload and NuGet resolvers before evaluation, include the trim-safe MSBuild and NuGet dependencies, and exercise stock SDK resolution in the Native AOT test layout. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 54c93774-3a89-47a1-a53a-14dbdd71a0c8
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
Wire the pack action into the Native AOT parser, evaluate PackRelease in process, and forward restore and Pack to the selected SDK while preserving managed fallback for unsupported inputs. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 54c93774-3a89-47a1-a53a-14dbdd71a0c8
Reuse the existing virtual project writer for evaluation-only file inputs, fall back for Roslyn directives and execution, and share entry-point validation with the managed CLI. 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
Reuse the physical MSBuild command path for publish, evaluate PublishRelease in process, preserve managed fallback for file-based execution, and cover the native parser and forwarding behavior. 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
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
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 54c93774-3a89-47a1-a53a-14dbdd71a0c8
|
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. |
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.
I highly suggest reviewing this commit-by-commit. Most of the actual work is in the first few commits, laying the infrastructure and enabling more CLI feature areas to build under NAOT (workload updates, MSbuild evaluation, etc). Then the actual command enablements are almost trivial by comparison.
Summary
pack,publish,build,restore,clean, andmsbuildthrough the Native AOT CLI while continuing to execute MSBuild out of process.RestoringCommandunchanged frommain..nuspecpacking and directive-bearing file-based apps.Validation
dotnet-aot, manageddotnet, and shipping Native AOT publication succeed.Size and performance
The same-toolchain Debug Native AOT image grows from 34,438,656 to 73,207,808 bytes: +38,769,152 bytes (+36.97 MiB, +112.6%). Nearly all of that increase comes from the initial MSBuild/NuGet evaluation closure (details at NuGet/Home#14846 (comment)); workload updates add about 1.44 MB and the later command migrations add less than 100 KiB combined.
packpublishbuildrestorecleanmsbuildTop-level CLI CPU falls by roughly 80-99%, and peak working set falls by 69-88%. Actual MSBuild execution remains in a child process, so these resource reductions represent CLI hosting and JIT overhead rather than the complete process tree.