Blazor doesnt resolve dependencies of a Razor Class Library

91 views Asked by At

My current Project has a main Blazor an UI-Component in a Razor Class Library. In this component I am trying to use a UI-Library called Radzen.

So the line of dependencies would look like this:

Blazor App -> RCL -> Radzen.Blazor

In the Razor Class Library itself my TestComponent.razor looks like this:

@using Radzen.Blazor

<h1>Test Component Start</h1>
<RadzenButton>Test</RadzenButton>
<h1>Test Component End</h1>

I than use the component like this in my Index.razor.

@using TestRazorLibrary

<TestRazorLibrary.TestComponent></TestRazorLibrary.TestComponent>

In the RCL itself it works fine but when I try to load my RCL in my main Blazor-project it throws an error that states the used Radzen.Blazor cant be found.

System.IO.FileNotFoundException: Could not load file or assembly 'Radzen.Blazor, Version=4.20.4.0, Culture=neutral, PublicKeyToken=null'. Das System kann die angegebene Datei nicht finden.
File name: 'Radzen.Blazor, Version=4.20.4.0, Culture=neutral, PublicKeyToken=null'
   at TestRazorLibrary.TestComponent.BuildRenderTree(RenderTreeBuilder __builder)
   at Microsoft.AspNetCore.Components.ComponentBase.<.ctor>b__6_0(RenderTreeBuilder builder)
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, Exception& renderFragmentException)
Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost: Error: Unhandled exception in circuit 'Zqk9k7-7Wh_U3LdUTZNqMPesunH0bEEw2aixfjcCm_Q'.

In the RCL, I included the Radzen.Blazor as a nuget package. And then I included the RCL dll in the Blazor App.

Id like to have the package ONLY installed in my Razor Class Library and resolved transitive in my main Blazor app.

Also here i use Radzen.Blazor but I get the error with every Library in a RCL.

In my research I havent found anything which is related to this topic. I think the RCL doesnt include the packages when building and thats why blazor cant access them but i am not sure. Thanks in advance!

0

There are 0 answers