79394484

Date: 2025-01-28 16:15:45
Score: 2
Natty:
Report link

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"
}
Reasons:
  • Blacklisted phrase (0.5): Thanks
  • RegEx Blacklisted phrase (1): I want
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Peter.Kippes