Skip to content

Fix double-publish ILLink error in BasicTestApp#65675

Merged
wtgodbe merged 2 commits into
mainfrom
wtgodbe/ILLink
Mar 7, 2026
Merged

Fix double-publish ILLink error in BasicTestApp#65675
wtgodbe merged 2 commits into
mainfrom
wtgodbe/ILLink

Conversation

@wtgodbe
Copy link
Copy Markdown
Member

@wtgodbe wtgodbe commented Mar 6, 2026

Fixes errors like:

ILLink : error IL1011: Failed to write 'D:\a_work\1\s\artifacts\obj\BasicTestApp\Release\net11.0\linked\Microsoft.Extensions.Configuration.dll'. [D:\a_work\1\s\src\Components\test\testassets\BasicTestApp\BasicTestApp.csproj]
C:\Users\cloudtest.nuget\packages\microsoft.net.illink.tasks\11.0.0-preview.1.26104.118\build\Microsoft.NET.ILLink.targets(108,5): error NETSDK1144: Optimizing assemblies for size failed. [D:\a_work\1\s\src\Components\test\testassets\BasicTestApp\BasicTestApp.csproj]

Microsoft.AspNetCore.Components.E2ETests.csproj references BasicTestApp twice - once directly, and once via Components.TestServer.csproj. Even though BuildProjectReferences=false, the latter will still try to publish BasicTestApp again due to https://github.com/dotnet/dotnet/blob/856f69955c79a685a753283ea03701c4d04264ba/src/sdk/src/StaticWebAssetsSdk/Targets/Microsoft.NET.Sdk.StaticWebAssets.Publish.targets#L116-L137. To avoid this, we can set StaticWebAssetsGetPublishAssetsTargets to a dummy no-op target when BasicTestApp is being published via the Components.TestServer.csproj ProjectReference in Microsoft.AspNetCore.Components.E2ETests.csproj.

@wtgodbe wtgodbe requested a review from a team as a code owner March 6, 2026 02:08
Copilot AI review requested due to automatic review settings March 6, 2026 02:08
@github-actions github-actions Bot added the area-blazor Includes: Blazor, Razor Components label Mar 6, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a build error (IL1011/NETSDK1144) that occurs when Microsoft.AspNetCore.Components.E2ETests.csproj triggers two concurrent publish runs for BasicTestApp — once directly and once transitively via Components.TestServer.csproj. The fix introduces a new opt-in MSBuild property _SkipReferencedProjectPublishAssets that, when set, redirects the Static Web Assets SDK's publish assets target to a no-op, preventing the redundant ILLink invocation.

Changes:

  • BasicTestApp.csproj: Adds a conditional PropertyGroup that overrides StaticWebAssetsGetPublishAssetsTargets to a no-op target when _SkipReferencedProjectPublishAssets=true, along with the no-op target definition.
  • Microsoft.AspNetCore.Components.E2ETests.csproj: Adds _SkipReferencedProjectPublishAssets=true to the Properties of the Components.TestServer ProjectReference when publishing in the TestTrimmedOrMultithreadingApps=true path, so the property flows into BasicTestApp's build when invoked transitively.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Components/test/testassets/BasicTestApp/BasicTestApp.csproj Adds a conditional no-op publish-assets target gated on _SkipReferencedProjectPublishAssets=true
src/Components/test/E2ETest/Microsoft.AspNetCore.Components.E2ETests.csproj Passes _SkipReferencedProjectPublishAssets=true to the Components.TestServer project reference to suppress the duplicate ILLink publish of BasicTestApp

@wtgodbe
Copy link
Copy Markdown
Member Author

wtgodbe commented Mar 6, 2026

Template test failures are unrelated, I'm investigating in #65676

@wtgodbe
Copy link
Copy Markdown
Member Author

wtgodbe commented Mar 7, 2026

/backport to release/10.0

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 7, 2026

Started backporting to release/10.0 (link to workflow run)

@wtgodbe wtgodbe merged commit 2b1cb0a into main Mar 7, 2026
25 checks passed
@wtgodbe wtgodbe deleted the wtgodbe/ILLink branch March 7, 2026 03:39
@dotnet-policy-service dotnet-policy-service Bot added this to the 11.0-preview3 milestone Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants