question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Publish hosted PWA from VS is broken

See original GitHub issue

Found 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:closed
  • Created 3 years ago
  • Comments:14 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
SteveSandersonMScommented, Apr 30, 2020

@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:

image

… then choose Local Git:

image

… then App Service build service (Kudu) and click “Finish”:

image

Then it will give you the URL for a Git repo:

image

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.

2reactions
javiercncommented, Apr 30, 2020

This is fixed in RC. Didn’t make the cut to preview5

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found