Publishing Hosted WebAssembly to Azure App Service Broken for .NET 5.0?
See original GitHub issueI 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:
- Created 3 years ago
- Reactions:2
- Comments:12 (2 by maintainers)
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).
Thank you, unless RC1 is coming out this week, a workaround is crucial. The site is down and can’t be re-published to…