Repository navigation
Conversation
Keep the settings file under intermediate output, refresh it around watch launches and rebuilds, and request it with a fresh validator to bypass stale development conditional responses. Narrow provider forwarding to connect and clear-cache, exercise live Web and Gateway hosts, and update build baselines. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
javiercn
requested review from
a team,
akoeplinger,
lbussell,
lewing,
maraf,
mthalman and
pavelsavara
as code owners
September 23, 2026 16:35
|
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. |
Keep the activation contract and cross-repository ownership guidance without discussing the host behavior in code comments or PR text. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Moderate unresolved issues remain around atomic writes, launch and project cleanup, generated-asset filtering, and UUID fallback support.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 2
Open (2)
What changed in this PR
This PR moves browser-tools activation to a build-owned Static Web Asset controlled by dotnet watch, while limiting provider routing and updating Web/WASM clients, lifecycle handling, tests, and baselines.
Changes:
- Adds build-only settings assets and endpoint metadata.
- Updates Watch lifecycle toggling and Web/WASM cache validation.
- Restricts provider and Gateway routes.
- Refreshes integration tests, documentation, and generated baselines.
| File | Description |
|---|---|
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Rebuild_RegeneratesJsonManifestAndCopiesItToOutputFolder.Build.staticwebassets.json |
Updates rebuild baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Rebuild_RegeneratesJsonManifestAndCopiesItToOutputFolder_Rebuild.Build.staticwebassets.json |
Updates rebuild baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Rebuild_RegeneratesJsonManifestAndCopiesItToOutputFolder_Rebuild.Build.files.json |
Updates generated files baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishWorks_With_PrecompressedAssets.Build.staticwebassets.json |
Updates compression baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishWorks_With_PrecompressedAssets.Build.files.json |
Updates generated files baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_WorksWithStaticWebAssetsV1ClassLibraries.Build.staticwebassets.json |
Updates referenced-assets baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_PublishSingleFile_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json |
Updates single-file publish baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_NoBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json |
Updates no-build baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_IncorporatesInitializersFromClassLibrariesAndPublishesAssetsToTheRightLocation.Build.staticwebassets.json |
Updates initializer baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json |
Updates publish baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_DifferentBuildAndPublish_LibraryInitializers.Build.staticwebassets.json |
Updates build/publish baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_AppendTargetFrameworkToOutputPathFalse_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json |
Updates output-path baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Publish_WithExternalProjectReference_UpdatesAssets.Build.staticwebassets.json |
Updates external-reference baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Publish_PublishSingleFile_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json |
Updates single-file baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Publish_NoBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json |
Updates no-build baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Publish_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json |
Updates publish baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/DoesNotFailToCompress_TwoAssetsWith_TheSameContent.Build.staticwebassets.json |
Updates compression baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/DoesNotFailToCompress_TwoAssetsWith_TheSameContent.Build.files.json |
Updates generated files baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Clean_RemovesManifestFrom_BuildAndIntermediateOutput.Build.staticwebassets.json |
Updates clean baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/CanEnable_CompressionOnAllAssets.Build.staticwebassets.json |
Updates compression baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_WorksWithStaticWebAssetsV1ClassLibraries.Build.staticwebassets.json |
Updates referenced-assets baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_WorksWithStaticWebAssetsV1ClassLibraries.Build.files.json |
Updates generated files baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_NoDependencies_GeneratesJsonManifestAndCopiesItToOutputFolder.Build.staticwebassets.json |
Updates build baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_NoDependencies_GeneratesJsonManifestAndCopiesItToOutputFolder_NoDependencies.Build.staticwebassets.json |
Updates no-dependencies baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_NoDependencies_GeneratesJsonManifestAndCopiesItToOutputFolder_NoDependencies.Build.files.json |
Updates generated files baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_IncorporatesInitializersFromClassLibraries.Build.staticwebassets.json |
Updates initializer baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_IncorporatesInitializersFromClassLibraries.Build.files.json |
Updates generated files baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_GeneratesJsonManifestAndCopiesItToOutputFolder.Build.staticwebassets.json |
Updates build baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_GeneratesJsonManifestAndCopiesItToOutputFolder.Build.files.json |
Updates generated files baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_DeployOnBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json |
Updates deploy-on-build baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_CorrectlyBundlesScopedCssFiles.Build.staticwebassets.json |
Updates scoped-CSS baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_CorrectlyBundlesScopedCssFiles.Build.files.json |
Updates generated files baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_WithExternalProjectReference_UpdatesAssets.Build.staticwebassets.json |
Updates external-reference baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_WithExternalProjectReference_UpdatesAssets.Build.files.json |
Updates generated files baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_UpdatesManifest_WhenFilesChange.Build.staticwebassets.json |
Updates manifest baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_UpdatesManifest_WhenFilesChange.Build.files.json |
Updates generated files baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_UpdatesManifest_WhenFilesChange_Updated.Build.staticwebassets.json |
Updates changed-manifest baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_UpdatesManifest_WhenFilesChange_Updated.Build.files.json |
Updates generated files baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_GeneratesJsonManifestAndCopiesItToOutputFolder.Build.staticwebassets.json |
Updates build baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_GeneratesJsonManifestAndCopiesItToOutputFolder.Build.files.json |
Updates generated files baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_FingerprintsContent_WhenEnabled.Build.staticwebassets.json |
Updates fingerprinting baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_FingerprintsContent_WhenEnabled.Build.files.json |
Updates generated files baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_DoesNotUpdateManifest_WhenHasNotChanged.Build.staticwebassets.json |
Updates incremental baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_Detects_PrecompressedAssets.Build.staticwebassets.json |
Updates compression baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_Detects_PrecompressedAssets.Build.files.json |
Updates generated files baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_DeployOnBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json |
Updates deploy-on-build baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_DefaultDocumentAndSpaFallback_CreatesAdditionalEndpoints.Build.staticwebassets.json |
Updates endpoint baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_CrosstargetingTests_CanIncludeBrowserAssets.Build.staticwebassets.json |
Updates cross-targeting baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_CrosstargetingTests_CanIncludeBrowserAssets.Build.files.json |
Updates generated files baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_CreatesEndpointsForAssets.Build.staticwebassets.json |
Updates endpoint baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_Can_DisableAssetCaching.Build.staticwebassets.json |
Updates caching baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_Can_DisableAssetCaching.Build.files.json |
Updates generated files baseline. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetEndpointsIntegrationTest.cs |
Verifies settings endpoint metadata. |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/DotNetWatchBrowserToolsIntegrationTest.cs |
Tests settings lifecycle and asset behavior. |
test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/StaticWebAssets_BuildMinimal_Works.Build.staticwebassets.json |
Updates standalone WASM baseline. |
test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/StaticWebAssets_BuildMinimal_Works.Build.files.json |
Updates generated files baseline. |
test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/StaticWebAssets_Build_Hosted_Works.Build.staticwebassets.json |
Updates hosted WASM baseline. |
test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/JSModules_ManifestIncludesModuleTargetPaths.Build.staticwebassets.json |
Updates JS module baseline. |
test/Microsoft.AspNetCore.Watch.BrowserRefresh.Tests/HostingStartupTest.cs |
Verifies routing changes. |
test/dotnet-watch.Tests/Browser/BrowserToolsEndpointRouterTests.cs |
Tests provider routes. |
test/dotnet-watch.Tests/Browser/BrowserToolsBuildOutputsTests.cs |
Tests settings mutation. |
test/dotnet-watch.Tests/Browser/BrowserTests.cs |
Tests graceful shutdown behavior. |
test/dotnet-watch.Tests/Browser/BrowserRefreshServerTests.cs |
Tests Gateway routes. |
src/WebSdk/Web/Targets/DotNetWatch/Microsoft.NET.Sdk.BlazorWeb.DotNetWatch.lib.module.js |
Adds fresh settings validators. |
src/WasmSdk/Sdk/DotNetWatch/Microsoft.NET.Sdk.WebAssembly.DotNetWatch.lib.module.js.template |
Adds fresh settings validators. |
src/StaticWebAssetsSdk/Targets/Microsoft.NET.Sdk.StaticWebAssets.DotNetWatch.targets |
Generates and registers settings assets. |
src/StaticWebAssetsSdk/Targets/DotNetWatch/dotnet-watch-browser-tools.config.js.template |
Updates activation documentation. |
src/StaticWebAssetsSdk/AGENTS.md |
Documents asset behavior. |
src/Dotnet.Watch/Web.Middleware/HostingStartup.cs |
Removes settings forwarding. |
src/Dotnet.Watch/Web.Middleware/ApplicationPaths.cs |
Removes the provider settings path. |
src/Dotnet.Watch/Watch/Process/ProjectLauncher.cs |
Enables settings before launch. |
src/Dotnet.Watch/Watch/HotReload/HotReloadDotNetWatcher.cs |
Manages Watch lifecycle toggling. |
src/Dotnet.Watch/Watch/Browser/BrowserToolsBuildOutputs.cs |
Reads and writes settings state. |
src/Dotnet.Watch/Watch/AppModels/WebApplicationAppModel.cs |
Adds settings lifecycle helpers. |
src/Dotnet.Watch/Watch/AppModels/BlazorWebAssemblyAppModel.cs |
Restricts Gateway proxy routes. |
src/Dotnet.Watch/HotReloadClient/Web/BrowserToolsProtocol.cs |
Removes provider settings contract. |
src/Dotnet.Watch/HotReloadClient/Web/BrowserToolsEndpointRouter.cs |
Stops serving provider settings. |
src/Dotnet.Watch/AGENTS.md |
Documents routing and lifecycle behavior. |
.github/memory/ARCHITECTURE.md |
Updates architecture documentation. |
.claude/skills/author-swa-integration-test/references/test-asset-catalog.md |
Documents the Gateway test asset. |
Comment on lines
+88
to
+96
| if (!current.AsSpan().SequenceEqual(settings)) | ||
| { | ||
| try | ||
| { | ||
| File.WriteAllBytes(SettingsPath, settings); | ||
| } | ||
| catch (Exception e) when (e is IOException or UnauthorizedAccessException) | ||
| { | ||
| throw Fail($"'{SettingsFileName}' could not be updated ({e.GetType().Name})"); |
Comment on lines
+54
to
+56
| if (appModel is WebApplicationAppModel webAppModel && clients.BrowserRefreshServer != null) | ||
| { | ||
| webAppModel.EnableBrowserToolsSettings(clientLogger); |
maraf
approved these changes
Sep 23, 2026
javiercn
marked this pull request as draft
September 23, 2026 17:48
Write a completion marker after normal builds and expose the settings-to-marker pair to Visual Studio's design-time up-to-date check. Verify a changed settings asset is reset by the next build without rewriting unchanged assets or causing subsequent builds to rewrite settings. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
maraf
self-requested a review
September 23, 2026 18:36
Exercise the project-system timestamp decision with real SDK design-time items and build entry points. Cover skip, rebuild and missing-source/destination cases without adding project-system dependencies, and retain the item when either generated file is absent. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Map Razor Components in the live Web host and leave DOTNET_WATCH disabled so the existing Razor and Gateway fallback endpoints coexist with the build-owned static asset during the transition. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Member
|
@javiercn Do we still want to land this? |
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
Replace the provider-owned
GET /_framework/dotnet-browser-tools/hot-reload-settings.jsonactivation response with an application-hosted, build-only Static Web Asset at the same stable route. A normal build writes{ "hotReload": false }inobj/<configuration>/<tfm>/dotnet-watch/; Watch changes that file totrueafter compilation before launch/relaunch, restorestrueafter in-process rebuilds, and resets it on graceful shutdown. Writes are skipped when bytes are unchanged. No user source files are modified.The settings asset is non-fingerprinted, excluded from compression and publish, and carries
Cache-Control: no-storeendpoint metadata. Its endpoint order (-1001) precedes existing host fallback endpoints. The Web and WebAssembly initializers usefetch(..., { cache: 'no-store' })with a distinct UUID-basedIf-None-Matchvalidator on each settings request. The Gateway proxy now forwards only/connectand/clear-cache; the hosting startup and provider no longer forward/serve settings. The build-owned JavaScript, RSA public/private key split, application-hosted trusted code, authenticated WebSocket/replay, and MVC/Blazor activation paths remain unchanged.Compared with the merged endpoint approach (#56118 and #56234): provider availability no longer controls activation through a forwarded HTTP response. The build owns the disabled settings document and Watch toggles that one output file; executable browser tools and the public key still come exclusively from the application, while the provider remains limited to the authenticated socket and cache-clear routes. This PR targets main, not either prior PR branch.
Incrementality and fast up-to-date check
Normal builds update a private, non-asset completion marker after restoring the settings file to false. Design-time builds expose
UpToDateCheckBuiltwith that marker as the output and the settings file asOriginal, following the project-system fast up-to-date-check contract. A later watch write makes settings newer than the marker, so Visual Studio schedules an ordinary build rather than skipping MSBuild. That build restores false and advances the marker; repeated ordinary builds leave settings and generated metadata unchanged. The marker is removed on Clean and is neither a Static Web Asset nor published. Hosted WebAssembly reports the pair for the browser-facing client, not the server.The SDK tests follow the repository's design-time build pattern with
DesignTimeBuild=trueandBuildingInsideVisualStudio=true, and emulate the project-system test cases for source-newer, source missing, and destination missing. They read the real generatedUpToDateCheckBuilt/Originalpair, apply the corresponding existence/timestamp decision, and call the SDK build only when needed. The Web/Gateway scenarios verify skip → build → skip, and missing settings/marker cases verify the pair stays available and the next build recreates the missing file. These tests do not run or depend on the Visual Studio CPS check itself.Validation
build.cmd -nobl /v:q: passed (0 warnings, 0 errors).LastWriteTimeUtcadvances only for the changed settings file; the build manifest reflects its current timestamp at SWA's one-second precision; and a subsequent unchanged build preserves the settings bytes, timestamp, configuration timestamp, and manifest bytes. The design-time tests assert the settingsOriginal/markerUpToDateCheckBuiltpair and that a changed settings file becomes newer than the marker before a build, but not afterward.If-None-Match: "browser-tools-<UUID>"requests returned HTTP 200 with false → true → true → false → false from the same host, including changes to the obj file after compilation without rebuilding/restarting the host. Build endpoints are single-route, non-fingerprinted, uncompressed, no-store metadata, and publish/clean exclude/remove the asset.cache: 'no-store', unchanged app PID 30428. The generated WASM initializer on the Gateway observed four 200 responses and four distinct UUID validators across false → true → true → false; its runtime activation flag followed true/false. No application restart was needed.Cross-repository follow-up
Removing the existing Gateway and Razor Components fallback endpoints requires a separate dotnet/aspnetcore PR; none are changed here. The SWA settings endpoint takes precedence while those fallbacks remain.