Thanks to jwenzel and other posts I did find a solution which I want to publish here, so that others do not have to read all the information.
Put either one of the solutions into Program.cs
right under
var builder = WebApplication.CreateBuilder(args);
Solution1 Source: How to call .UseStaticWebAssets() on WebApplicationBuilder?
if (builder.Environment.IsEnvironment("DevelopmentPK"))
{
builder.WebHost.UseWebRoot("wwwroot").UseStaticWebAssets();
}
Solution2 Source: Unable to call StaticWebAssetsLoader.UseStaticWebAssets
if (builder.Environment.IsEnvironment("DevelopmentPK"))
{
StaticWebAssetsLoader.UseStaticWebAssets(builder.Environment, builder.Configuration);
}
Replace DevelopmentPK
with the name of your Environment, defined in launchSettings.json
.
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "DevelopmentPK"
}