1
votes

I am trying to follow this article to create a razor component library. This in itself is not an issue.

The issue comes when i try to reference this project to my Blazor project.

When i create my Blazor project, it is always created as a .Net Standard project. The Razor component library is created as an Asp.net Core project.

I am unable to create the Blazor project as Asp.net Core. And im unable to create the component library as .Net standard.

What am i doing wrong here?

1

1 Answers

2
votes

Let's begin here:

I am unable to create the Blazor project as Asp.net Core

Selecting server-side Blazor results in a project in Asp.net Core With server-side Blazor you can create a Razor Class Library. With client-side Blazor you cannot create a Razor Class Library. You can instead create a Blazor component library. The Blazor component library should be created by the blazorlib template in a command shell... Do this:

dotnet new blazorlib -o MyComponentLib1

Now add the newly created Blazor component library project to your solution, and use it according to the instructions described here:https://docs.microsoft.com/en-us/aspnet/core/blazor/class-libraries?view=aspnetcore-3.0&tabs=visual-studio#consume-a-library-component

Hope this helps...