3

I have a RCL with razor components that have their own scoped CSS and some resources (like png background, etc.) in the wwwroot folder.

If I consume this library from a Blazor server app doing the add reference to the project in the same solutions, it works perfectly like described here https://learn.microsoft.com/en-us/aspnet/core/blazor/components/class-libraries?view=aspnetcore-6.0&tabs=visual-studio

But If I compile the RCL and add the reference pointing directly to the DLL nor CSS neither images are loaded

<Project Sdk="Microsoft.NET.Sdk.Web">

  <!-- it works-->
  <ItemGroup>
    <ProjectReference Include="..\BlazorRCL.Library\BlazorRCL.Library.csproj" />
  </ItemGroup>

  <!-- doesn't work
  <ItemGroup>
    <Reference Include="BlazorRCL.Library">
      <HintPath>..\BlazorRCL.Library\bin\Release\net6.0\BlazorRCL.Library.dll</HintPath>
    </Reference>
  </ItemGroup>
-->
</Project>

reference to project

reference to DLL

SandroRiz
  • 903
  • 4
  • 10
  • 18
  • 1
    Does this answer your question? [Reference directly a Razor Class Library assembly](https://stackoverflow.com/questions/58205775/reference-directly-a-razor-class-library-assembly) – Yogi Apr 04 '22 at 16:33
  • 1
    The answer to your question is that a direct reference to a RCL is not supported. See this MS doc under heading [Reference RCL content](https://learn.microsoft.com/en-us/aspnet/core/razor-pages/ui-class?view=aspnetcore-3.0&tabs=visual-studio#reference-rcl-content) – Yogi Apr 04 '22 at 16:35
  • 1
    As an alternative, you could build a local nuget package and reference it by adding a nuget.config file to the solution. I have done this before and it works well. See: [nuget.config](https://learn.microsoft.com/en-us/nuget/reference/nuget-config-file) – Yogi Apr 04 '22 at 16:54
  • I'm having the same problem. Did you find any workaround or a solution? – Rahul Oct 31 '22 at 16:07

0 Answers0