Repository navigation
Publish XML documentation during optimized Native AOT builds - #56620
Merged
marcpopMSFT merged 2 commits intoOct 19, 2026
Merged
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 2 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix native AOT publish failure with documentation file
Publish XML documentation during optimized Native AOT builds
Oct 13, 2026
marcpopMSFT
marked this pull request as ready for review
October 14, 2026 00:09
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The targeted fix preserves existing behavior and includes scenario-accurate regression coverage.
0 open findings
What changed in this PR
Fixes optimized Native AOT publishing so generated XML documentation is sourced from compiler output.
Changes:
- Uses
DocFileItemfor optimized publish while preserving regular publish behavior. - Adds regression coverage verifying XML publication without managed
binartifacts.
| File | Description |
|---|---|
Microsoft.NET.Publish.targets |
Selects the correct XML documentation source. |
GivenThatWeWantToPublishAnAotApp.cs |
Covers the failing Native AOT scenario. |
🧠 Review effort: Balanced
Member
|
@baronfel the difference in those items: |
This was referenced Oct 15, 2026
baronfel
approved these changes
Oct 15, 2026
Member
|
/tactics |
mgravell
added a commit
to protobuf-net/protobuf-net
that referenced
this pull request
Oct 21, 2026
…1377) Main CI has been red since 2026-10-19, failing in `native-aot-linux` → "Publish and run the gRPC smoke test": ``` error MSB3030: Could not copy the file "bin/Release/net8.0/linux-x64/AotGrpcSmoke.xml" because it was not found. ``` Nothing in the repo caused it - the first failing run was a docs-only commit. The `11.0.x` channel in setup-dotnet rolled from 11.0.100-rc.1 (last green run, Oct 13) to 11.0.100-rc.2, which has a known regression: a native-AOT publish fails with MSB3030 when XML documentation generation is enabled (dotnet/sdk#56618, minimal repro in dotnet/sdk#56653; fix proposed upstream in dotnet/sdk#56620 but not in any released SDK). `src/Directory.Build.props` turns `GenerateDocumentationFile` on for every Release build, and AotGrpcSmoke was the one natively-published project without the opt-out every other smoke/test project already has. AotSmoke publishes identically on the same rc.2 SDK and passes *because* it opts out, so the same run that found the bug also proved the fix. A smoke exe was never meant to ship API docs anyway - the dozen CS1591 "missing XML comment" warnings on `Contracts.cs` go away with it. One line plus a comment recording why, so it survives the rc.2 bug being fixed upstream.
This was referenced Oct 26, 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.

Native AOT publish can fail with MSB3030 when
GenerateDocumentationFileis enabled: optimized publish skips the Build step that copies the XML file tobin, but publish expects it there.DocFileItemas the XML source for optimized AOT publish; preserveFinalDocFilefor regular publish.bin.Tactics
Summary
Optimized (
UseOptimizedPublish) Native AOT publish skips the Build step that copies the compiler-generated XML documentation file tobin, but the publish targets still expected it there, causing MSB3030. The fix inMicrosoft.NET.Publish.targetsuses the compiler-generatedDocFileItem(intermediate output) as the XML source for optimized AOT publish, and keepsFinalDocFilefor regular publish. This is a small, targeted fix for a regression that breaks AOT publish whenGenerateDocumentationFileis enabled.Customer Impact
Publishing a
PublishAotproject withGenerateDocumentationFile=truefails witherror MSB3030: Could not copy the file ".../bin/.../API.xml" because it was not found(reported in #56618 on 11.0.100-rc.2). Any AOT project generating documentation is affected. Workaround: set<UseOptimizedPublish>false</UseOptimizedPublish>.Regression?
Yes, introduced in .NET 11 RC.1 by #54515 (per #56618).
Testing
Adds assertions (3 lines) to
GivenThatWeWantToPublishAnAotAppcovering AOT publish with generated XML docs, verifying the XML is published without managed build files inbin. Reviewed and approved by baronfel; Copilot review found no issues. CI pipelines were triggered; no manual or private validation is documented in the PR.Risk
Low. Change is ~9 added/1 removed lines in one targets file, scoped to the optimized AOT publish path, with regular publish unchanged and regression test coverage.