Skip to content

[browser] Integrate DevServer into WasmAppHost #88985

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 29 commits into from
Jul 29, 2023
Merged

Conversation

maraf
Copy link
Member

@maraf maraf commented Jul 17, 2023

  • Integrate (copy) Blazor DevServer into WasmAppHost
    • DevServer origins
      • Copied from Blazor DevServer without any change
        • ComponentsWebAssemblyApplicationBuilderExtensions.cs
        • ContentEncodingNegotiator.cs
        • WebAssemblyNetDebugProxyAppBuilderExtensions.cs
      • DevServer.cs is mix between WebServer and asptnetcore DevServer/Program.cs
      • DevServerStartup.cs mix between WebServerStartup and asptnetcore DevServer/Startup.cs
      • DevServerOptions.cs is inspired by WebServerOptions
      • DebugProxyLauncher.cs changed folder where it expects debug proxy
    • The WasmAppHost still remains in workload, because of the console template
    • The WasmAppHost is also included in the Wasm SDK pack for running without workload from Wasm SDK
    • If we finish the console template in .NET 8, we can remove WasmAppHost from the workload
  • The BrowserHost switches between WebServer and DevServer based on static web assets manifest presence
    • We probably could remove WebServer later
    • The solution still uses runtime config
  • Make HTMLPath optional
  • Set run parameters for Wasm SDK
    • It's in the Browser.targets because that is the topmost place where OutputPath is correctly set. Unfortunatelly it's after the default run parameters are set. So it must override it
    • It uses _WebAssemblyUserRunParameters to preserve user defined values. The property will be set in SDK dotnet/sdk@569f220
    • It checks for "blazor-devserver.dll" to preserve Blazor setting. We could use different check once the UsingMicrosoftNETSdkBlazorWebAssembly is removed from Wasm SDK
  • Until resolved, TestAppScenarios pass GenerateRuntimeConfigurationFiles=true as command line argument to override Microsoft.NET.Sdk.WebAssembly.Browser.targets#L64
  • Remove GenerateRuntimeConfigurationFiles=false from Wasm SDK, since the WasmAppHost needs it and Blazor SDK Move GenerateRuntimeConfigurationFiles=false back to Blazor SDK from Wasm SDK sdk#34177 change already flown to installer
  • DebugProxy tested manually
  • Tested that is doesn't interfere with Blazor's DevServer from nuget package

Contributes to #70762

@maraf maraf added arch-wasm WebAssembly architecture area-Host os-browser Browser variant of arch-wasm labels Jul 17, 2023
@maraf maraf added this to the 8.0.0 milestone Jul 17, 2023
@maraf maraf self-assigned this Jul 17, 2023
@ghost
Copy link

ghost commented Jul 17, 2023

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

TBD

Author: maraf
Assignees: maraf
Labels:

arch-wasm, area-Host, os-browser

Milestone: 8.0.0

@maraf maraf marked this pull request as ready for review July 21, 2023 12:59
Copy link
Member

@radical radical left a comment

Choose a reason for hiding this comment

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

Looks great!

@maraf maraf merged commit d5c4a4e into dotnet:main Jul 29, 2023
@maraf maraf deleted the WasmBrowserHost branch August 14, 2023 07:45
@ghost ghost locked as resolved and limited conversation to collaborators Sep 13, 2023
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
arch-wasm WebAssembly architecture area-Host os-browser Browser variant of arch-wasm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants