Publish hosted PWA from VS is broken
See original GitHub issueFound during verification. Repro:
- Create a new Blazor WebAssembly hosted + PWA project
- Using the VS user interface, publish the “Server” project
Result:
Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(191,5): Error : Conflicting assets with the same path '/service-worker.js' for content root paths 'C:\Users\username\source\repos\BlazorApp45\Client\obj\Release\netstandard2.1\blazor\serviceworkers\wwwroot\service-worker.js' and 'C:\Users\username\source\repos\BlazorApp45\Client\wwwroot\service-worker.js'.
I’m pretty sure the issue was introduced here: https://github.com/dotnet/aspnetcore/commit/8232c6a4d86872ca2641c2b7379409240056aaef#diff-2d7c5407183e4a97df7698f63cd8a945L92-R181 (link seems not to work correctly, so search for _OmitServiceWorkerContent
in the diff)
The code in that diff removes one of the two cases where _OmitServiceWorkerContent
runs, and I think that’s the case where it’s needed when publishing from VS.
Most likely the fix is just to re-add ResolveCurrentProjectStaticWebAssetsInputs
to the set of BeforeTargets
there, but this could use input from @javiercn in case he had different intentions for how this should work.
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (3 by maintainers)
Top Results From Across the Web
Default Blazor PWA project cannot be host into IIS
You can try the following steps to publish an Blazor WebAssembly App on iis. I tested it can work normally on my pc....
Read more >Blazor PWA Not Able to Install After Publishing on Azure ...
In the development environment it was working fine and the PWA install button was appearing accurately. But as soon as I published the ......
Read more >ASP.NET Core Blazor Progressive Web Application (PWA)
Learn how to build a Blazor Progressive Web Application (PWA) that use modern browser features to behave like a desktop app.
Read more >Host and deploy ASP.NET Core Blazor WebAssembly
Learn how to host and deploy Blazor WebAssembly using ASP.NET Core, Content Delivery Networks (CDN), file servers, and GitHub Pages.
Read more >Chrome PWA app broken after Windows update
After the latest Windows 10 update, all my PWA apps launch the Windows defaults app window. On my system, that's the only thing...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ShockwaverReal Easiest workaround is to publish from the command-line instead (
dotnet publish -c Release
).Or if your goal is to deploy to Azure App Service, consider deploying via Git (i.e., Kudu). This is much more useful than deploying from VS anyway. In your App Service, go to Deployment Center:
… then choose Local Git:
… then App Service build service (Kudu) and click “Finish”:
Then it will give you the URL for a Git repo:
Add this as an extra remote on your local repo (e.g.,
git remote add azure <url>
) and you can push to it (git push -u azure master
). To get the username/password, click on Deployment Credentials as you see in the screenshot above.This is fixed in RC. Didn’t make the cut to preview5