Repository navigation
Conversation
Keep Local assets available to their own project while excluding them from build and publish project-reference exports regardless of project mode. Preserve WebAssembly browser-tools propagation and existing asset modes, and cover lifecycle, endpoint, compression and plain Web SDK references. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 2 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Local assets remain reachable through exported discovery patterns, while compressed variants can be exported without their primary assets and cause consumers’ compression negotiation to throw.
2 open issues
What changed in this PR
Adds AssetMode=Local to the .NET SDK’s static web assets pipeline so server Hot Reload browser tools remain available to their owning project without propagating through project references. This addresses #56656 while preserving hosted WebAssembly browser-tools propagation.
Changes:
- Adds Local-mode validation and reference-export filtering, and enables it for server browser tools.
- Extends lifecycle and integration coverage for compression, manifests, endpoints, and project references.
- Updates documentation and 37 manifest baselines.
Baseline filenames below are relative to test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/, unless another path is shown.
| File | Description |
|---|---|
Rebuild_RegeneratesJsonManifestAndCopiesItToOutputFolder.Build.staticwebassets.json |
Expects Local browser tools before rebuild. |
Rebuild_RegeneratesJsonManifestAndCopiesItToOutputFolder_Rebuild.Build.staticwebassets.json |
Expects Local browser tools after rebuild. |
PublishWorks_With_PrecompressedAssets.Build.staticwebassets.json |
Updates precompressed publish baseline. |
PublishProjectWithReferences_WorksWithStaticWebAssetsV1ClassLibraries.Build.staticwebassets.json |
Updates legacy-library publish baseline. |
PublishProjectWithReferences_PublishSingleFile_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json |
Updates referenced single-file publish baseline. |
PublishProjectWithReferences_NoBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json |
Updates referenced no-build publish baseline. |
PublishProjectWithReferences_IncorporatesInitializersFromClassLibrariesAndPublishesAssetsToTheRightLocation.Build.staticwebassets.json |
Updates initializer publish baseline. |
PublishProjectWithReferences_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json |
Updates referenced publish baseline. |
PublishProjectWithReferences_DifferentBuildAndPublish_LibraryInitializers.Build.staticwebassets.json |
Updates build/publish initializer baseline. |
PublishProjectWithReferences_AppendTargetFrameworkToOutputPathFalse_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json |
Updates alternate-output-path baseline. |
Publish_WithExternalProjectReference_UpdatesAssets.Build.staticwebassets.json |
Updates external-reference publish baseline. |
Publish_PublishSingleFile_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json |
Updates single-file publish baseline. |
Publish_NoBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json |
Updates no-build publish baseline. |
Publish_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json |
Updates standard publish baseline. |
DoesNotFailToCompress_TwoAssetsWith_TheSameContent.Build.staticwebassets.json |
Updates identical-content compression baseline. |
Clean_RemovesManifestFrom_BuildAndIntermediateOutput.Build.staticwebassets.json |
Updates clean scenario baseline. |
CanEnable_CompressionOnAllAssets.Build.staticwebassets.json |
Updates compress-all baseline. |
BuildProjectWithReferences_WorksWithStaticWebAssetsV1ClassLibraries.Build.staticwebassets.json |
Updates legacy-library build baseline. |
BuildProjectWithReferences_NoDependencies_GeneratesJsonManifestAndCopiesItToOutputFolder.Build.staticwebassets.json |
Updates initial dependency-build baseline. |
BuildProjectWithReferences_NoDependencies_GeneratesJsonManifestAndCopiesItToOutputFolder_NoDependencies.Build.staticwebassets.json |
Updates no-dependencies build baseline. |
BuildProjectWithReferences_IncorporatesInitializersFromClassLibraries.Build.staticwebassets.json |
Updates referenced initializer baseline. |
BuildProjectWithReferences_GeneratesJsonManifestAndCopiesItToOutputFolder.Build.staticwebassets.json |
Updates referenced build baseline. |
BuildProjectWithReferences_DeployOnBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json |
Updates referenced deploy-on-build baseline. |
BuildProjectWithReferences_CorrectlyBundlesScopedCssFiles.Build.staticwebassets.json |
Updates scoped CSS scenario baseline. |
Build_WithExternalProjectReference_UpdatesAssets.Build.staticwebassets.json |
Updates external-reference build baseline. |
Build_UpdatesManifest_WhenFilesChange.Build.staticwebassets.json |
Updates initial file-change baseline. |
Build_UpdatesManifest_WhenFilesChange_Updated.Build.staticwebassets.json |
Updates modified-file baseline. |
Build_GeneratesJsonManifestAndCopiesItToOutputFolder.Build.staticwebassets.json |
Updates standard build baseline. |
Build_FingerprintsContent_WhenEnabled.Build.staticwebassets.json |
Updates fingerprinted browser-tools baseline. |
Build_DoesNotUpdateManifest_WhenHasNotChanged.Build.staticwebassets.json |
Updates unchanged-manifest baseline. |
Build_Detects_PrecompressedAssets.Build.staticwebassets.json |
Updates precompressed discovery baseline. |
Build_DeployOnBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json |
Updates deploy-on-build baseline. |
Build_DefaultDocumentAndSpaFallback_CreatesAdditionalEndpoints.Build.staticwebassets.json |
Updates fallback endpoint baseline. |
Build_CrosstargetingTests_CanIncludeBrowserAssets.Build.staticwebassets.json |
Updates cross-targeting baseline. |
Build_CreatesEndpointsForAssets.Build.staticwebassets.json |
Updates endpoint-generation baseline. |
Build_Can_DisableAssetCaching.Build.staticwebassets.json |
Updates disabled-caching baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/StaticWebAssetTest.cs |
Tests Local validation and serialization. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ResolveCompressedAssetsTest.cs |
Tests compression preserving asset mode. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/GenerateStaticWebAssetsDevelopmentManifestTest.cs |
Tests Local development-manifest inclusion. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/GenerateStaticWebAssetEndpointsManifestTest.cs |
Tests Local build and publish endpoints. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ComputeStaticWebAssetsForCurrentProjectTest.cs |
Tests local inclusion across project modes. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ComputeReferenceStaticWebAssetItemsTest.cs |
Tests reference asset and endpoint exclusion. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/LocalStaticWebAssetsIntegrationTest.cs |
Adds Local build/publish integration coverage. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/HotReloadBrowserToolsIntegrationTest.cs |
Covers server references and hosted WebAssembly. |
test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/StaticWebAssets_HostedApp_ReferencingNetStandardLibrary_Works.Build.staticwebassets.json |
Updates hosted-app server asset metadata. |
src/WebSdk/Web/Targets/Sdk.Server.targets |
Selects Local mode for server browser tools. |
src/StaticWebAssetsSdk/Tasks/Data/StaticWebAsset.cs |
Defines and validates Local mode. |
src/StaticWebAssetsSdk/Tasks/Data/StaticAssetsManifest.cs |
Excludes Local assets from reference exports. |
src/StaticWebAssetsSdk/Targets/Microsoft.NET.Sdk.StaticWebAssets.targets |
Documents Local asset metadata. |
src/StaticWebAssetsSdk/Targets/Microsoft.NET.Sdk.StaticWebAssets.HotReload.targets |
Applies configurable browser-tools asset mode. |
src/StaticWebAssetsSdk/Architecture.md |
Documents visibility and export semantics. |
src/StaticWebAssetsSdk/AGENTS.md |
Updates browser-tools contributor guidance. |
.github/memory/ARCHITECTURE.md |
Records server versus WebAssembly ownership. |
Review effort: Balanced
Preserve Local visibility for checked-in compressed alternatives and retain their original Content identity for publish cleanup. Omit exported runtime discovery roots containing Local files while retaining explicit shared asset entries and unrelated roots. Cover both paths with build/publish and real ASP.NET Core file-provider regressions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This branch has not been deployed
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.


Summary
Introduce
AssetMode=Local: assets remain available to their own project but are never exported through project references, regardless ofStaticWebAssetProjectMode. Preserve existingAll,CurrentProject, andReferencebehavior.Use
Localfor server Web SDK Hot Reload browser-tools assets to fix #56656. Keep WebAssembly browser-tools assets propagating to their hosting server. Reuse the shared reference-export predicate and existing endpoint projection rather than adding browser-tools-specific filtering or target hooks.Add focused lifecycle and integration coverage for validation, serialization, compression, local build/publish availability, reference exclusion, ordinary initializer propagation, and hosted WebAssembly. Update related documentation and manifest baselines.
Validation
ReferenceOutputAssembly=trueandfalse; each project retained its own three browser-tools primaries, gzip alternatives, and serving endpoints, with no browser tools in publish output.Allmode reproduced the original missing-initializer-endpoints failure.The 37 regenerated manifest snapshots contain only 222
All-to-Localmetadata changes; unrelated ordering churn was removed.