Set webassembly WebRootFileProvider environment variable (in .csproj file) to ManifestEmbeddedFileProvider

29 Views Asked by At

I use this link: Can Razor Class Library pack static files (js, css etc) too? for my webassembly project that I want to also pack, to disable the default WebRootFileProvider and replace it with ManifestEmbeddedFileProvider, The reason: because I want to nuget pack this webassembly project and add it to another webassembly project and currently when I build, the package web assets, conflict with the project web assets and the code from the link:

builder.Services.ConfigureOptions(typeof(UIConfigureOptions)); // sets the default file provider to a manifest file provider

is not executed during build.

so I went to this doc: https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.hosting.iwebhostenvironment?view=aspnetcore-8.0 , in IWebHostEnvironment, There is a WebRootFileProvider that I can set to ManifestEmbeddedFileProvider in the project file like this:

<PropertyGroup>
  <CscEnvironment>WebRootPath=wwwroot;WebRootFileProvider=?</CscEnvironment>
</PropertyGroup>

so how to do the above code correctly so that I replace the default file provider with ManifestEmbeddedFileProvider?

or any solution to disable StaticWebAssets creation when I build?

0

There are 0 best solutions below