1
votes

How can we create a "common" Blazor Component library with version 3.0.100 ? Formerly to 3.0.100 we could use:

dotnet new blazorlib -o <some project output name>

But this entry does not exist any more by default, i've tried next:

dotnet new -i Microsoft.AspNetCore.Blazor.Templates
dotnet new blazorlib -o BlazorPOC.Lib
dotnet sln add BlazorPOC.Lib\BlazorPOC.Lib.csproj

This creates a library project in .NET Standard 2.0 into the solution which makes references to next NuGet:

<ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Blazor.Browser" Version="0.7.0" />
    <PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="0.7.0" PrivateAssets="all" />
</ItemGroup>

But ... when I build i get :

Severity    Code    Description Project File    Line    Suppression State
Error       rzc generate exited with code 1.    BlazorPOC.Lib   C:\Users\emmnuy\.nuget\packages\microsoft.aspnetcore.blazor.build\0.7.0\targets\RazorCompilation.targets    184 

This does not work out. So my question is, how to i create a reusable component library for blazor which can be shared and referenced from within a .NET Core 3.0 based Blazor App.

Thx for your feedback !

Emmanuel Nuyttens

1
Did you update templates with the latest version ?agua from mars

1 Answers

2
votes

The Razor Class Library template is now set up for Blazor component development by default and the Blazor Class Library template has been removed in favor of new Razor Class Library projects.

From the command line use: dotnet new razorclasslib