Images in Blazor Class Library available if referencing the .csproj, but unavailable in NuGet package once deployed and consumed via Nuget

I am working on a Blazor Component Library on .NET 8 within a corporation that contains many different officially designed and branded Components. Most work fine without flaw, but the Icon component is having issues finding the .svg files after being packed and consumed by another application via Nuget Package Manager.

When I reference the .csproj as a project reference and include the entire code base, it seems to find the files fine.

The files in question are .svg files. We have a collection of around 1000 files at wwwroot/images/icons that are all Blue. I’ve created a Python script that runs pre-build to generate other colors of icons. These other colors are placed into their own folders at wwwroot/images/icons_xxxxxx where xxxxxx is the hex color code of the icons.

In the Icon.razor.cs code, I have it referencing a hard-coded folder location of _content/ProjectName/images/icons + _xxxxxx/ with a small function to combine the file name onto the path as needed. It is worth mentioning that the Blue icons (the originals) are available within the Nuget package. It seems like the files generated by the pre-build step are not being included, but when I check the .nupkg file, all files are available under staticwebassets folder.

I’ve tried changing my hard-coded file path to look at staticwebassets instead of _content but to no affect.

Here I have my .csproj file which is being used in place of a .nuspec:


    <PropertyGroup>
        <TargetFramework>net8.0</TargetFramework>
        <Nullable>enable</Nullable>
        <ImplicitUsings>enable</ImplicitUsings>
        <Configurations>Debug;Release;SkipIconPrebuildStep</Configurations>
    </PropertyGroup>

    <ItemGroup>
        <Content Remove="compilerconfig.json" />
        <Content Remove="wwwrootcssmain.scss" />
    </ItemGroup>

    <ItemGroup>
        <None Include="compilerconfig.json" />
        <None Include="wwwrootcsscomponents_filter.scss" />
        <None Include="wwwrootcssmain.scss" />

        <None Include="wwwrootimagesicons**.svg" />
        <None Include="wwwrootimagesSocial-Media*.*" />
    </ItemGroup>

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

    <ItemGroup>
        <PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.0" />
    </ItemGroup>

    <PropertyGroup>
        <Description>This library contains officially branded and designed controls or Razor or Blazor front end projects.</Description>
        <Authors>Software Team</Authors>
    </PropertyGroup>

    <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
        <DebugType>portable</DebugType>
    </PropertyGroup>

    <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='SkipIconPrebuildStep|AnyCPU'">
        <DebugType>portable</DebugType>
    </PropertyGroup>

    <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
        <DebugType>portable</DebugType>
    </PropertyGroup>

    <Target Name="PreBuild" BeforeTargets="PreBuildEvent" Condition="'$(Configuration)'!='SkipIconPrebuildStep'">
        <Exec Command="python "$(SolutionDir)scripts/UpsertIconColorFiles.py" "$(ProjectDir)wwwroot/images/icons/" "14853D"
python "$(SolutionDir)scripts/UpsertIconColorFiles.py" "$(ProjectDir)wwwroot/images/icons/" "C53532"
python "$(SolutionDir)scripts/UpsertIconColorFiles.py" "$(ProjectDir)wwwroot/images/icons/" "956D00"
python "$(SolutionDir)scripts/UpsertIconColorFiles.py" "$(ProjectDir)wwwroot/images/icons/" "767676"
python "$(SolutionDir)scripts/UpsertIconColorFiles.py" "$(ProjectDir)wwwroot/images/icons/" "FFFFFF"
python "$(SolutionDir)scripts/UpsertIconColorFiles.py" "$(ProjectDir)wwwroot/images/icons/" "8096B2"" />
    </Target>
    
</Project>

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật