Description
The .NET 11 SDK will no longer do a full build during AOT publish but rather only build the minimum needed to produce the AOT compiled output.
Version
.NET 11 RC 2
Previous behavior
When publishing with PublishAot=true, the full MSBuild Build target was executing as part of the publish pipeline, producing a complete self-contained managed deployment (apphost, DLLs, deps.json, runtimeconfig.json, and runtime pack files) in the output (bin\) directory. These artifacts are entirely unused by the AOT pipeline, which reads from @(IntermediateAssembly) in obj\, not from bin\.
New behavior
This change introduces a new _PublishOptimizedBuild target that runs only Compile (plus resource and satellite assembly targets) instead of the full Build for AOT publish, eliminating the confusing managed artifacts from the output directory while preserving all AOT publish functionality. A public opt-out property UseOptimizedPublish is provided for projects that rely on Build extensibility points (e.g., BeforeBuild, AfterBuild, BeforeTargets/AfterTargets="Build") or packages like Microsoft.Extensions.ApiDescription.Server. This fix is scoped to AOT-only in .NET 11 to minimize risk; expansion to other publish modes is planned for .NET 12 early previews (tracked in dotnet/sdk#55911).
Type of breaking change
Reason for change
Reduce customer confusion on which binaries to use and save on AOT publish time. Now there should only be binaries in the publish folder.
Recommended action
Customers who have msbuild logic during AOT publish that depends on the full build could change to depend on publish targets instead.
Customers can opt-out into the old behavior by setting UseOptimizedPublish=false.
Feature area
SDK
Affected APIs
No response
Description
The .NET 11 SDK will no longer do a full build during AOT publish but rather only build the minimum needed to produce the AOT compiled output.
Version
.NET 11 RC 2
Previous behavior
When publishing with PublishAot=true, the full MSBuild Build target was executing as part of the publish pipeline, producing a complete self-contained managed deployment (apphost, DLLs, deps.json, runtimeconfig.json, and runtime pack files) in the output (bin\) directory. These artifacts are entirely unused by the AOT pipeline, which reads from @(IntermediateAssembly) in obj\, not from bin\.
New behavior
This change introduces a new _PublishOptimizedBuild target that runs only Compile (plus resource and satellite assembly targets) instead of the full Build for AOT publish, eliminating the confusing managed artifacts from the output directory while preserving all AOT publish functionality. A public opt-out property UseOptimizedPublish is provided for projects that rely on Build extensibility points (e.g., BeforeBuild, AfterBuild, BeforeTargets/AfterTargets="Build") or packages like Microsoft.Extensions.ApiDescription.Server. This fix is scoped to AOT-only in .NET 11 to minimize risk; expansion to other publish modes is planned for .NET 12 early previews (tracked in dotnet/sdk#55911).
Type of breaking change
Reason for change
Reduce customer confusion on which binaries to use and save on AOT publish time. Now there should only be binaries in the publish folder.
Recommended action
Customers who have msbuild logic during AOT publish that depends on the full build could change to depend on publish targets instead.
Customers can opt-out into the old behavior by setting UseOptimizedPublish=false.
Feature area
SDK
Affected APIs
No response