'Blazor Component Library as nuget Package does not provide css files

Okay,

I am really struggling by creating a nuget package for a BCL.

During the development, I have pushed created some *.scss files for my blazor components. Now, I want to use these components in a separate nuget package and consume it within other projects.

So far so good, but unfortunately all my css-files aren't within the nuget package.

What I've tried:

All my components has it's own *.scss file. After building the project, there are some css files, e.g. HelloWorld.razor.css.

When I am runing the dotnet pack command, there aren't any css files within the nuget package.

I've already included the EmbeddedResource Element to my csproj file, now I can see all the css file, but my BlazorApp won't apply the styles at all.

I've already studied the documentation (https://docs.microsoft.com/en-us/aspnet/core/blazor/components/css-isolation) but I still not able to enable the styles.

I have also tryied to reference the project directly to my BlazorApp, and it worked. Is it a NuGet issue?

My csproj looks like follows:

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

    <PropertyGroup>
        <TargetFramework>net6.0</TargetFramework>
        <Nullable>enable</Nullable>
        <ImplicitUsings>enable</ImplicitUsings>
        <AssemblyVersion>1.0.12.0</AssemblyVersion>
        <FileVersion>1.0.12.0</FileVersion>
        <Version>1.0.12-rc.33</Version>
    </PropertyGroup>


    <ItemGroup>
        <SupportedPlatform Include="browser" />
    </ItemGroup>

    <PropertyGroup>
        <StaticWebAssetBasePath>_content/$(PackageId)</StaticWebAssetBasePath>
        <DisableScopedCssBundling>false</DisableScopedCssBundling>
        <ScopedCssEnabled>true</ScopedCssEnabled>
    </PropertyGroup>

    <ItemGroup>
        <EmbeddedResource Include="**\**\*.css" />
    </ItemGroup>

    <ItemGroup>
        <PackageReference Include="Delegate.SassBuilder" Version="1.4.0" />
        <PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.2" />
    </ItemGroup>
</Project>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source