Search code examples
c#asp.net-coreblazornugetblazor-webapp

Blazor Web App nuget package missing static files from external nugets


I have a Blazor Web App recently upgraded from Blazor Server. As part of the process it is packed to a nuget. After the upgrade I noticed that when you pack the project it is missing static files like css and js from referenced nugets. For example this line in App.razor does not seem to do the work anymore.

<link href="_content/Radzen.Blazor/css/default.css" rel="stylesheet" />

I had to copy paste entire CSS from dev tools and reference it as "my own" file.

This is how my project file looks like

    <ItemGroup>
    <Content Include="bin/Release/net8.0/**/*.*">
        <PackagePath>Test</PackagePath>
        <Pack>true</Pack>
    </Content>
</ItemGroup>
<ItemGroup>
    <None Include="wwwroot/**/*.*">
        <Pack>true</Pack>
        <PackagePath>Test/wwwroot/</PackagePath>
        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
</ItemGroup>        

Can anyone help?


Solution

  • its changed for .net 8 i believe use like this, but still reference the js file.

    <RadzenTheme Theme="material" @rendermode="InteractiveAuto" />
    

    https://blazor.radzen.com/get-started?theme=material3