Found during verification. Repro:
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.
Any walkaround?
Recommended workaround until preview 5 is to publish from the command line.
The problem still exists in preview 5.
The problem still exists in preview 5.
It's the same for me
I just hit this issue on Preview 5 when building through VS.
Same here, darn!
PWA 3.2.0-preview5.20216.8
VS 16.6.0 Preview 3.0
Please re-open.
This is fixed in RC. Didn鈥檛 make the cut to preview5
Suggestions on how your typical NuGet guy can work this around then?
@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.
I get this on every build in VS, when trying to debug etc.
2 workarounds for now if this helps anybody:
1) Do a clean before rebuild
2) Build from command line.
if you're running a dotnet core hosted blazor app:
(From the server project folder)
dotnet watch run -p ..\Client(projectname).Client.csproj
This of course doesn't help with debugging.
Edit:
Updating to RC1 does fix it thanks!
Confirmed working with RC1.
Thanks!
what is RC1?
Confirmed working with RC1.
Thanks!
what is RC1?
Confirmed working with RC1.
Thanks!
R(elease)C(andidate)1 (stated available yesterday)
Follow this guide for creating/updating projects with RC1
what is RC1?
Confirmed working with RC1.
Thanks!R(elease)C(andidate)1 (stated available yesterday)
Follow this guide for creating/updating projects with RC1
tnks
Most helpful comment
@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.