The base application (MyTestApp) is an ASP.NET Core MVC web app (based on the default template). In addition, a Razor Class Library (RCL) has been created (MyRazorClassLibrary). The css, js and lib folders of the MyTestApp are moved to wwwroot folder of the RCL.
MyRazorClassLibrary is a NuGet package which has been added to MyTestApp.
I've read and tried several solutions about static files in a RCL, but none of them seem to work properly. The files are loaded in MyTestApp, but are NOT (?!) visible (as linked reference) in Visual Studio 2022. In addition, I need to publish MyTestApp first in order to load the css, js files and run the app localhost?
Could you point me in the right direction and/or provide a .NET 6 demo app (which contains the described example)?
Default csproj of RCL:
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<SupportedPlatform Include="browser" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.10" />
</ItemGroup>
</Project>
Modified csproj of RCL (doesn't work):
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
</PropertyGroup>
<ItemGroup>
<SupportedPlatform Include="browser" />
</ItemGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="6.0.16" />
</ItemGroup>
</Project>