Blazor WASM Project Referencing Error (BLAZORSDK1001)

Kelvin Tee 1 Reputation point
2021-05-24T07:17:38.287+00:00

I have one Server project and now trying to convert it into Progressive Web Application. When I reference the API, Model, and UI projects to it then the following error comes out:

<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>

The following code is the .csproj of the project, is there something I'm missing?

<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
    <ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
</PropertyGroup>

<ItemGroup>
    <Content Remove="wwwroot\service-worker.js" />
</ItemGroup>

<ItemGroup>
    <PackageReference Include="Blazored.Toast" Version="3.1.2" />
    <PackageReference Include="BlazorInputFile" Version="0.2.0" />
    <PackageReference Include="DevExpress.Blazor" Version="20.1.7" />
    <PackageReference Include="Hangfire.AspNetCore" Version="1.7.11" />
    <PackageReference Include="Hangfire.Core" Version="1.7.11" />
    <PackageReference Include="Hangfire.SqlServer" Version="1.7.11" />
    <PackageReference Include="LiquidTechnologies.Blazor.ModalDialog" Version="0.9.7" />
    <PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.2.0-preview3.20168.3" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.4" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.4" PrivateAssets="all" />
    <PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="3.1.3" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.3" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="3.1.3" />
    <PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="5.0.5" />
    <PackageReference Include="Microsoft.AspNetCore.SignalR.Client.Core" Version="5.0.5" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.3" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.3">
        <PrivateAssets>all</PrivateAssets>
        <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" />
    <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
    <PackageReference Include="QRCoder" Version="1.4.1" />
    <PackageReference Include="Serilog.AspNetCore" Version="3.2.0" />
    <PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" />
    <PackageReference Include="Serilog.Sinks.Elasticsearch" Version="8.0.1" />
    <PackageReference Include="Serilog.Sinks.MSSqlServer" Version="5.3.0" />
    <PackageReference Include="Tewr.Blazor.FileReader" Version="2.0.0.20200" />
</ItemGroup>

<ItemGroup>
    <ProjectReference Include="..\DataAccess\DataAccess.csproj" />
    <ProjectReference Include="..\UI\UI.csproj" />
    <ProjectReference Include="..\API\API.csproj" />
    <ProjectReference Include="..\Model\Model.csproj" />
</ItemGroup>

</Project>

Are there any suggestions on solving this issue?

Developer technologies | .NET | Blazor
{count} votes

5 answers

Sort by: Most helpful
  1. Erick Leon 1 Reputation point
    2021-05-24T17:54:52.137+00:00

    Hi Kelvin, I have the same issue right now, after a few hours i use the hard method. Close all the tabs in visual studio, delete the bin and debug folders. Later, clean the complete solution and build all again. And the problem go away. I hope this help you.

    0 comments No comments

  2. gaozhe ouyang 1 Reputation point
    2021-06-02T08:25:06.337+00:00

    run into the same one when I try to Install-Package Dapr.AspNetCore -Version 1.2.0 to Blazor WASM

    0 comments No comments

  3. Arash Moussavi 1 Reputation point
    2021-06-17T08:58:22.133+00:00

    Have the same issue. When I comment out the PackageReference "Serilog.AspNetCore" then all good.

    0 comments No comments

  4. avi twito 21 Reputation points
    2021-08-30T14:09:16.573+00:00

    I am getting the exact same error when trying to add ElectronNET.API to fresh new blazor wasm project

    0 comments No comments

  5. Salisu Abubakar 0 Reputation points
    2024-02-02T20:08:13.92+00:00

    Go to the Package Reference (Your Project > Dependencies > Packages) in visual studio and check the exact name of the dll. The name is case sensitive. In my .csproj file the name is "iTextSharp" , but in the Package Reference its "itextsharp.dll". The error was cleared when i changed it to "itextsharp.dll". Hope this helps someone

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.