Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

In BlazorWebView WinForms/WPF, don't require wwwroot to exist in bin dir in development #4782

Merged

Conversation

SteveSandersonMS
Copy link
Member

Fixes #4537

Turns out we were a bit confused about what the problem was. We thought the issue was that your csproj needed to copy the content files to output explicitly. However, that's not the case, since:

  • In development, the underlying BlazorWebView library code already deals with using the SWA manifest to return the SWA content, without needing it to be copied to the output directory
  • When publishing, the Razor SDK already deals with copying the content into the publish output directory, so it can be supplied by a PhysicalFileProvider

The real problem is much simpler. Our code was trying to create a PhysicalFileProvider for $(OutDir)\wwwroot regardless of the fact that it doesn't need to exist there in development. By skipping doing that if it's not there, everything else just works.

This only affected WinForms and WPF, and not MAUI, because for MAUI we already deal with converting content items into MAUI content items, which then takes care of getting them to the right place for both dev and prod.

@SteveSandersonMS SteveSandersonMS requested a review from a team as a code owner February 18, 2022 16:27
Copy link
Member

@javiercn javiercn 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!

@SteveSandersonMS SteveSandersonMS enabled auto-merge (squash) February 18, 2022 16:32
@SteveSandersonMS SteveSandersonMS merged commit 3580670 into main Feb 18, 2022
@SteveSandersonMS SteveSandersonMS deleted the stevesa/blazorwebview-winforms-wpf-no-wwwroot branch February 18, 2022 17:09
@github-actions github-actions bot locked and limited conversation to collaborators Dec 23, 2023
@samhouts samhouts added the fixed-in-6.0.200-preview.14.2 Look for this fix in 6.0.200-preview.14.2! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fixed-in-6.0.200-preview.14.2 Look for this fix in 6.0.200-preview.14.2!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automatically copy wwwroot/** to publish directory
3 participants