question

KelvinTee-8020 avatar image
0 Votes"
KelvinTee-8020 asked avitwito-6481 answered

Blazor WASM Project Referencing Error (BLAZORSDK1001)

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?

dotnet-aspnet-core-blazor
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @KelvinTee-8020,

Perhaps you meet a compatibility issue. Can you tell us which projects you are adding in your WASM project? And please check the projects and the package version, make sure they are compatible.

Besides, you could also check your projects whether they are adding some package which is not compatible with your project or not? If find this kind of package, try to remove them.

0 Votes 0 ·

I have the same issue, just add a package adding the package reference ( in the csproj client file as 2nd package just after this line "<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="5.0.6" />"), after a load i just remove the package I added and the problem emerge. Simple as that. I just close all the tabs in the VS, remove bin and debug folders in the client project and execute a clean and build actions to the solution and the problem was solved. I dont understand why, but that was my day.

0 Votes 0 ·
ErickLeon-0416 avatar image
0 Votes"
ErickLeon-0416 answered

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

gaozheouyang-9417 avatar image
0 Votes"
gaozheouyang-9417 answered gaozheouyang-9417 published

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

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

bloodorange avatar image
0 Votes"
bloodorange answered

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

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

avitwito-6481 avatar image
0 Votes"
avitwito-6481 answered

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

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.