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.

Publishing Hosted WebAssembly to Azure App Service Broken for .NET 5.0?

See original GitHub issue

I have a Hosted WebAssembly solution with three projects (client, server, shared).

I have followed the instructions as detailed in the article to set the solution to .NET 5.0 : ( ASP.NET Core Updates in .NET 5 Preview 7 ) which includes the settings:

<TargetFramework>net5.0</TargetFramework> <RuntimeIdentifier>browser-wasm</RuntimeIdentifier> <UseBlazorWebAssembly>true</UseBlazorWebAssembly>

Note that there I have no build errors locally, the solution runs as expected. The issue I’ve come across is on the publish attempt.

I have a publish profile, previously working, that applies to the server app, publishing to the Azure App Service. That is now failing.

To check if the issue was specific to my existing setup, I started a new solution from scratch, only to face the same issue.

Upon attempting to publish in the new, scaffolded solution, I get the error "Metadata file ‘c:[PATH]\win-x86\[AppName].Client.dll’ could not be found. I expect that’s because the target framework of the client app is now publishing to a folder “browser-wasm,” no longer win-x86.

Under the publish settings, I have the following:

Target Framework: net5.0 Deployment Mode: Self-Contained Target Runtime: win-x86

There is no choice for “browser-wasm.”

If I build the publish profile for just the client project, I can choose browser-wasm, but then it doesn’t also publish the server project, which is obviously required for execution. My understanding is the publish needs to be from the server project.

Again, I have the issue on my developed solution, but also the same issue on a newly created solution from the framework without any added code.

Over the course of playing with my developed solution (not the new scaffolded solution), the error message eventually became: “Assets file ‘C:\[PATH]\Client\obj\project.assets.json’ doesn’t have the target for ‘.NETCoreApp,Version=v5.0/browser-wasm’. Ensure that restore has run and that you have included ‘net5.0’ in the TargetFrameworks for your project. You may also need to include ‘browser-wasm’ in your projects’ RuntimeIdentifiers.”

(Not entirely sure why that’s detailed as “TargetFrameworks” plural when my entry in the proj file is singular “TargetFramework.”)

If I add the runtime identifier of browser-wasm to the server project to get the error - which was a reach to work - "There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier ‘browser-wasm’.

Also, any direct manipulation of the project.assets.json file is overwritten on publishing, so that wasn’t a workaround.

Please advise ASAP as I am unable to publish any changes and the site is non-functional via the Azure App Service.

Thank you…

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
stbsolutionscommented, Aug 8, 2020

Eric, I get the same exact error with Preview 7 (self-contained deployment). However, with Preview 6 (also self-contained deployment), I don’t get the error and the app works fine in Azure (It’s a Blazor Server app).

I’m not sure if the issue when deploying to Azure might be that Blazor (both WebAssembly and Server) starting on .Net 5 Preview 7 now target “.Net 5” and Azure can’t yet handle that (instead of targeting netcoreapp5.0 or netstandard2.1 in .Net 5 preview 6 and prior).

1reaction
ericpincuscommented, Jul 29, 2020

Thank you, unless RC1 is coming out this week, a workaround is crucial. The site is down and can’t be re-published to…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can not publish Blazor wasm to azure anymore
Same issue for me. Publish stopped working after the latest VS update. Removing blanks in path resolved it.
Read more >
How do I deploy a Blazor WebAssembly application to ...
Select the created web app service (blazor-publish). Deploying to Azure App Service 5. Navigate to the overview section, click on Get ...
Read more >
Azure Publish Asp.net core 5.0 hosted web assembly ( VS ...
I've created a new Asp.NET Core 5.0 Blazor web assembly hosted on Asp.net core server. Publishing the app to Azure is taking longer...
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 >
Azure app service reverts .net 5 to .net 3.1 after publish
I have a blazor wasm app I am deploying to Azure App service using VS 2019 publish feature. I have noticed in the...
Read more >

github_iconTop Related Medium Post

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