Razor class library static web assets on different urls before and after publish when libman used

92 views Asked by At

I use static web assets in razor class library, and they are on different paths on local run under VS and published final docker image. In JoinRpg.WebComponents RCL there is .\JoinRpg.WebComponents\wwwroot\lib\bootstrap-select\js\bootstrap-select.js which is dynamically added to build using Microsoft.Web.LibraryManager.Build task.

In JoinRpg.Portal ASP.NET Core project which are reference JoinRpg.WebComponents using ProjectReference, this js file is:

  • Local run: /_content/JoinRpg.WebComponents/lib/bootstrap-select/js/bootstrap-select.js
  • Docker image: /lib/bootstrap-select/js/bootstrap-select.js

If it's not restored by Microsoft.Web.LibraryManager.Build they always be at correct path /_content/JoinRpg.WebComponents.

Adding if (env.IsDevelopment()) { StaticWebAssetsLoader.UseStaticWebAssets(env, Configuration); } changes nothing.

I want js file be on the same URL on local and remote run.

0

There are 0 answers