You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I want to be able to serve files with a custom file path (js/v1/foo.js can be mapped to a real file at wwwroot/js/foo.js). I created VersionedFileProvider which could map that already. I set it like this:
app.UseStaticFiles(new StaticFileOptions()
{
FileProvider = new CompositeFileProvider(
new VersionedFileProvider(env.WebRootPath),
env.WebRootFileProvider),
});
All files are working. However, if I use that custom path, asp-append-version does not work. When I check the source code, they are taking WebRootFileProvider instead of the one I am setting in UseStaticFiles.
Luckily, env.WebRootFileProvider is settable, so I can resolve the problem with:
env.WebRootFileProvider = new CompositeFileProvider(
new VersionedFileProvider(env.WebRootPath),
env.WebRootFileProvider);
app.UseStaticFiles();
For now I have not seen any problem yet. However, I have to admit I do not know what else is using WebRootFileProvider and what side-effect can possibly happen. Please help me confirm this is a proper way to resolve my issue.
Describe the solution you'd like
Can we have a way to set IFileProvider that FileVersionProvider is using? Or at least a documentation text that confirms setting env.WebRootFileProvider is okay? Thank you.
The text was updated successfully, but these errors were encountered:
datvm
changed the title
A way to change IFileProvider that FileVersionProvider is using?
A way to change IFileProvider that FileVersionProvider (asp-append-version) is using?
Nov 26, 2019
javiercn
added
the
area-mvc
Includes: MVC, Actions and Controllers, Localization, CORS, most templates
label
Nov 26, 2019
Is your feature request related to a problem? Please describe.
I want to be able to serve files with a custom file path (
js/v1/foo.js
can be mapped to a real file atwwwroot/js/foo.js
). I createdVersionedFileProvider
which could map that already. I set it like this:All files are working. However, if I use that custom path,
asp-append-version
does not work. When I check the source code, they are takingWebRootFileProvider
instead of the one I am setting inUseStaticFiles
.Luckily,
env.WebRootFileProvider
is settable, so I can resolve the problem with:For now I have not seen any problem yet. However, I have to admit I do not know what else is using
WebRootFileProvider
and what side-effect can possibly happen. Please help me confirm this is a proper way to resolve my issue.Describe the solution you'd like
Can we have a way to set
IFileProvider
thatFileVersionProvider
is using? Or at least a documentation text that confirms settingenv.WebRootFileProvider
is okay? Thank you.The text was updated successfully, but these errors were encountered: