Skip to content

Remove Identity-without-backing-file quirk from Static Web Assets#53819

Draft
javiercn wants to merge 2 commits intomainfrom
javiercn/remove-quirks
Draft

Remove Identity-without-backing-file quirk from Static Web Assets#53819
javiercn wants to merge 2 commits intomainfrom
javiercn/remove-quirks

Conversation

@javiercn
Copy link
Copy Markdown
Member

Remove the legacy quirk where static web asset Identity could point to a non-existent file, with OriginalItemSpec used as a fallback source.

Changes

Core simplifications:

  • ComputeCandidateIdentity always returns the real file path — no more synthesizing identities under the content root
  • Removed CopyCandidates output from DefineStaticWebAssets and all supporting infrastructure (CopyCandidate class, cache tracking)
  • ResolveFile only uses Identity (removed OriginalItemSpec fallback)
  • CollectStaticWebAssetsToCopy always uses asset.Identity as source (removed IsComputed branch with file-existence checks)

Target/downstream simplifications:

  • ServiceWorker.targets: removed Exists('%(Identity)') / OriginalItemSpec fallback pattern
  • AssetToCompress: removed RelatedAssetOriginalItemSpec fallback
  • ResolveCompressedAssets: removed RelatedAssetOriginalItemSpec metadata emission

Target ordering fix:

  • _ComputeScopedCssStaticWebAssets now depends on _ProcessScopedCssFiles to ensure scoped CSS output files exist before asset definition

9 files changed, 36 insertions, 181 deletions.

@github-actions github-actions bot added the Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, StaticWebAssetsSDK label Apr 10, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Thanks for your PR, @@javiercn.
To learn about the PR process and branching schedule of this repo, please take a look at the SDK PR Guide.

- Simplify ComputeCandidateIdentity to always use the real file path as
  identity, instead of synthesizing a path under the content root when
  the file is not under it
- Remove CopyCandidates output from DefineStaticWebAssets and all
  supporting infrastructure (CopyCandidate class, cache tracking)
- Simplify ResolveFile to only use Identity (remove OriginalItemSpec
  fallback)
- Simplify CollectStaticWebAssetsToCopy to always use asset.Identity
  as source (remove IsComputed branch with file-existence checks)
- Simplify ServiceWorker.targets to always use Identity (remove
  Exists('%(Identity)') / OriginalItemSpec fallback pattern)
- Simplify AssetToCompress to only use RelatedAsset (remove
  RelatedAssetOriginalItemSpec fallback)
- Remove RelatedAssetOriginalItemSpec metadata from ResolveCompressedAssets
- Fix _ComputeScopedCssStaticWebAssets to depend on _ProcessScopedCssFiles
  ensuring scoped CSS output files exist before asset definition
- Update test for new identity behavior
@javiercn javiercn force-pushed the javiercn/remove-quirks branch from 24c42a8 to 5a9b471 Compare April 10, 2026 21:38
… fallback

Remove tests that validated the removed RelatedAssetOriginalItemSpec
fallback behavior and update remaining tests to match the simplified
TryFindInputFilePath that only uses RelatedAsset.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, StaticWebAssetsSDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant