Answered by:
Blazor WASM project - unexplained error message AND nuget packages have disappareared cannot get them back

Question
-
User379720387 posted
Brand spanking new NET5 Blazor WASM project and life was good no squiggles and during the first build this error message pops up:
Severity Code Description Project File Line Suppression State
Error BLAZORSDK1001 The project references the ASP.NET Core shared framework, which is not supported by Blazor WebAssembly apps. Remove the framework reference if directly referenced, or the package reference that adds the framework reference. SchoolClient C:\Program Files\dotnet\sdk\5.0.202\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.Current.targets 635
Which takes me to this:
<Target Name="_FailIfReferencingAspNetCoreApp" BeforeTargets="ResolveRuntimePackAssets"> <Error Code="BLAZORSDK1001" Text="The project references the ASP.NET Core shared framework, which is not supported by Blazor WebAssembly apps. Remove the framework reference if directly referenced, or the package reference that adds the framework reference." Condition="'@(FrameworkReference->WithMetadataValue('Identity', 'Microsoft.AspNetCore.App')->Count())' != '0'" /> </Target>
Did a search for Microsoft.AspNetCore.App in the solution, nothing shows except what is above here.
Then I noticed my razor page all of a sudden has squiggles for anything related to MudBlazor. Looking in Dependencies and Packages I see all yellow triangles. Since learned this means that the physical files have been removed.
Roamed around SO for a few hours and been trying a few of the suggestions, and I cannot get these to re-install. PMC pretends like it is going to install thembut then nothing happens.
As a last resort I have created another Blazor WASM project thinking I was going to copy the contents of the Packages folder over to the dirty solution. The new solution has NO yellow triangles, but where are these files?
Any ideas on how to resolve this?
Did some more experimenting:
Brand spanking new WASM project, all is fine, then when I install MudBlazor the error message pops up, and I get the yellow triangle in front of the MudBlazor reference
Then when I add a brand new WASM project (none aspnet core hosted, then adding MudBlazor works like it should.
What is the significance of aspnetcore hosted project vs none?
Friday, May 7, 2021 9:39 PM
Answers
-
User-474980206 posted
Then I’d suspect one of the following projects has a reference to asp.net
<ProjectReference Include="..\..\SchoolAPI\SchoolAPI.csproj" /> <ProjectReference Include="..\Shared\SchoolClientY.Shared.csproj" />
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Sunday, May 9, 2021 4:04 PM
All replies
-
User-474980206 posted
you are adding a package reference to WASM project that is only for asp.net core server projects. Review the installation instructions of the vendor package or contact them for support.
Saturday, May 8, 2021 3:41 PM -
User379720387 posted
There is only one package and the installation instructions are provided for Blazor Server and Blazor WASM.
https://www.mudblazor.com/getting-started/installation
Saturday, May 8, 2021 3:54 PM -
User475983607 posted
The yellow triangle on a reference is usually a compatibility warning. See the mudblazor support to make sure you are using a version compatible with your project.
Saturday, May 8, 2021 4:33 PM -
User-474980206 posted
There is only one package and the installation instructions are provided for Blazor Server and Blazor WASM.
https://www.mudblazor.com/getting-started/installation
If you look at their template, here is the WASM project file. Yours should match
Saturday, May 8, 2021 10:25 PM -
User379720387 posted
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly"> <PropertyGroup> <TargetFramework>net5.0</TargetFramework> <ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest> </PropertyGroup> <ItemGroup> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.5" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.5" PrivateAssets="all" /> <PackageReference Include="MudBlazor" Version="5.0.8" /> <PackageReference Include="System.Net.Http.Json" Version="5.0.0" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\SchoolAPI\SchoolAPI.csproj" /> <ProjectReference Include="..\Shared\SchoolClientY.Shared.csproj" /> </ItemGroup> <ItemGroup> <ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" /> </ItemGroup> </Project>
Sunday, May 9, 2021 2:28 AM -
User-474980206 posted
Then I’d suspect one of the following projects has a reference to asp.net
<ProjectReference Include="..\..\SchoolAPI\SchoolAPI.csproj" /> <ProjectReference Include="..\Shared\SchoolClientY.Shared.csproj" />
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Sunday, May 9, 2021 4:04 PM -
User379720387 posted
Yes, indeed.
SchoolAPI was the guilty party.
Tuesday, May 11, 2021 1:14 PM