Pre-generate publish-compressed framework assets during build#67500
Open
wtgodbe wants to merge 2 commits into
Open
Pre-generate publish-compressed framework assets during build#67500wtgodbe wants to merge 2 commits into
wtgodbe wants to merge 2 commits into
Conversation
Parallel consumer publishes each trigger Microsoft.AspNetCore.App.Internal.Assets' publish-compression in its shared obj dir on different MSBuild nodes, racing on the same .br/.gz output and intermittently failing with 'file is being used by another process'. Running the compression once during this project's (ordered, single) build warms the incremental cache so later concurrent publishes skip the write. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Mitigates intermittent parallel publish failures in the shared framework build by pre-generating publish-compressed Static Web Assets during the producer project’s ordered build, so later concurrent consumer publishes should hit incremental outputs rather than racing on shared obj paths.
Changes:
- Adds an MSBuild target to warm publish-compressed static web assets after
Build. - Gates the new target on NodeJS builds and compression being enabled.
Open
3 tasks
javiercn
reviewed
Jul 1, 2026
Member
There was a problem hiding this comment.
Disable compression, we don't need it enabled here <CompressionEnabled>false</CompressionEnabled>. We don't put compressed assets on packages and they'll be compressed by the final app
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.
Problem
Parallel consumer publishes intermittently fail the
Build shared fx/ publish legs with:Root-caused from the binlog of build 1482653 (
Tests: Helix x64 Subset 1 / Build shared fx): two consumers (Components.Authorizationon node 3,Components.Gatewayon node 1) each trigger a publish of the sharedMicrosoft.AspNetCore.App.Internal.Assetsproject concurrently on different MSBuild nodes. Both runGeneratePublishCompressedStaticWebAssetsagainst the same producer obj dir ($(IntermediateOutputPath)compressed/publish), so one writes the.brwhile the other reads/writes it → sharing violation. Survey: ~16/308 builds over 7 days on def 83.The SDK ties the compressed output path to the producing project's
IntermediateOutputPath(no per-consumer override exists), and the per-node result cache doesn't dedupe the publish invocation across nodes.Fix (mitigation)
Run the publish-compression once during
App.Internal.Assets' own (single, ordered) build via anAfterTargets="Build"target. The compress tasks are incremental, so by the time consumers publish, the.br/.gzare already up-to-date and the concurrent invocations skip the write — leaving only safe concurrent reads.