I am trying to start a Blazor WASM application; I have the latest .NET 5 installed, VS2019 16.8, etc. I have existing projects that will be referenced in the both of the Blazor generated projects *.Client && *.Server. The .Server project handles the project references without issue. But, the .Client project is having issues with my "Library" project. When I add the project reference, I am getting these build errors:
The type or namespace name 'ApplicationPartAttribute' does not exist in the namespace 'Microsoft.AspNetCore.Mvc.ApplicationParts' (are you missing an assembly reference?)
I've since gone nearly file by file, class by class, in that project to narrow down the issue: name reference and usage of Microsoft.AspNetCore.Mvc will cause this build error. Excluding these files or methods and then rebuilding the .Client project, solves the issue. The classes utilizing the .Mvc namespace all deal with my exception filters, action filters, etc and are rather vital to speedy development. I'm leaning towards breaking up the library and having the .Mvc stuff reside separately, but, that seems rather ridiculous, but, then again, maybe I'm wrong.
I've installed the Microsoft.AspNetCore.Mvc and Microsoft.AspNetCore.Mvc.Core nuget packages on the .Client project, and no change. All projects in the solution are running on .NET 5. These links speak about the issue and a sort of "fix" for it:
- https://github.com/dotnet/aspnetcore/issues/21849#issuecomment-662030144
- https://github.com/dotnet/aspnetcore/issues/24171
- https://github.com/dotnet/aspnetcore/issues/25380
When I was using the 16.8 Preview, I implemented this "fix", but debugging the Blazor project was a nightmare. Oddly, I've not found much info regarding this issue and why it is happening nor any true ways to fix it.
Has anyone encountered this issue? Am I missing something here?
There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier 'browser-wasm'.Programing Blazor apps sounds like an nightmare :( Tons of meaning-nothing errors where you have to do private investigation to understand what is going on ;( - Piotr