Referencing Radzen.Blazor from a library

  1. In Visual Studio create Razor Class Library project.
  2. Add the nuget package Radzen.Blazor
  3. Add @using Radzen into _Imports.razor

Error CS0246 The type or namespace name 'Radzen' could not be found (are you missing a using directive or an assembly reference?)

Is it possible to reference Radzen.Blazor from an assembly which contains UI controls/components which are then used across several Blazor projects? (What is the correct way to do it?)

There are no differences - check the instruction here:
https://blazor.radzen.com/get-started

You need both Radzen and Radzen.Blazor .

Thank you for your prompt response!

I have found the reason. When you create the 'Razor Class Library' in Visual Studio it always sets the target framework to .Net Standard 2.1 although you specified .NET Core 3.1.
So once you manually open the project file and changes the target framework to netcoreapp3.1 the Radzen is then correctly recognized.

1 Like

For me, my "Razor Class Library"-Project was set to Target framework ".NET Standard 2.0".
Changing it to ".NET Standard 2.1" did the trick.

Changing to .NET Core for no purpose (if you use it with Blazor) is not the best idea (for my opinion)