Skip to content

Fix double-publish compression error in TestContentPackage - #68085

Open
ilonatommy wants to merge 1 commit into
mainfrom
fix-32219
Open

Fix double-publish compression error in TestContentPackage#68085
ilonatommy wants to merge 1 commit into
mainfrom
fix-32219

Conversation

@ilonatommy

Copy link
Copy Markdown
Member

Trying to fix the reported race issue: #61178 (comment). The methodology used is same as in #65675, we just extend it to TestContentPackage asset.

@ilonatommy
ilonatommy requested a review from wtgodbe July 29, 2026 12:14
@ilonatommy ilonatommy self-assigned this Jul 29, 2026
@ilonatommy
ilonatommy requested a review from a team as a code owner July 29, 2026 12:14
Copilot AI review requested due to automatic review settings July 29, 2026 12:14
@ilonatommy ilonatommy added area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework area-blazor Includes: Blazor, Razor Components labels Jul 29, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hey @dotnet/aspnet-build, looks like this PR is something you want to take a look at.

@ilonatommy ilonatommy changed the title Fix double-publish ILLink error in TestContentPackage. Fix double-publish error in TestContentPackage. Jul 29, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Extends the existing “skip referenced-project publish assets” pattern used in Components E2E trimmed publishing to TestContentPackage, preventing redundant Static Web Assets publish work that can race when multiple projects publish concurrently.

Changes:

  • Adds an MSBuild conditional override for StaticWebAssetsGetPublishAssetsTargets when _SkipReferencedProjectPublishAssets=true.
  • Introduces a no-op target _SkipGetPublishAssetsForTrimmedBuild to short-circuit Static Web Assets’ referenced-project publish-assets execution.

@ilonatommy ilonatommy changed the title Fix double-publish error in TestContentPackage. Fix double-publish compression error in TestContentPackage Jul 29, 2026

@wtgodbe wtgodbe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One clarifying question

@@ -6,6 +6,13 @@
<StaticWebAssetBasePath>_content/TestContentPackage</StaticWebAssetBasePath>
</PropertyGroup>

<PropertyGroup Condition="'$(_SkipReferencedProjectPublishAssets)' == 'true'">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are we sure _SkipReferencedProjectPublishAssets will be set here when we need it to?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It looks like the issue is that  Components.TestServer.csproj references BasicTestApp.csproj and Components.WasmMinimal.csproj, both of which reference this project w/ identical global properties, so there's a race

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, the race is the reason for double publish. As you say, we have something like

Components.TestServer
|___BasicTestApp
|     |___TestContentPackage
|___ Components.WasmMinimal
      |___TestContentPackage

and when E2ETests.csproj is built we have both: BasicTestApp.csproj

<ProjectReference Include="..\testassets\BasicTestApp\BasicTestApp.csproj" Targets="Build;Publish" Properties="BuildProjectReferences=false;TestTrimmedApps=true;PublishDir=$(MSBuildThisFileDirectory)$(OutputPath)trimmed\BasicTestApp\" />

and Components.TestServer
<ProjectReference Include="..\testassets\Components.TestServer\Components.TestServer.csproj" Targets="Build;Publish" Properties="BuildProjectReferences=false;TestTrimmedApps=true;_SkipReferencedProjectPublishAssets=true;PublishDir=$(MSBuildThisFileDirectory)$(OutputPath)trimmed\Components.TestServer\;" />

publish triggered. The first one is missing _SkipReferencedProjectPublishAssets property, the latter has it set. That's good. That means that one of the publishes will be skipped, the other one won't. That eliminate the race. Do I get it right?

@ilonatommy
ilonatommy requested a review from wtgodbe July 30, 2026 08:51
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 area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants