See how PinpointTownes implemented this in their OpenIddict project.
You can use the UseStaticFiles call with the EmbeddedFileProvider . This is part of the rc1-final package, as you can see here . The corresponding code is on GitHub .
Just for future readers:
app.UseStaticFiles(new StaticFileOptions { FileProvider = new EmbeddedFileProvider( assembly: Assembly.Load(new AssemblyName("OpenIddict.Assets")), baseNamespace: "OpenIddict.Assets") });
OpenIddict.Assets is the name of the assembly / project containing static resources.
Update:
After you dig a bit through the source and find the correct repository, there is also PhysicalFileProvider , which you can use instead of packing into an assembly and point to an arbitrary folder in the file system.
app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider("/path/to/shared/staticfiles") });
Update 2:
Just for completeness, there is also a CompositeFileProvider that can be used to create several IFileProviders to create some kind of virtual file system structure, that is, if the file is not found in the PhysicalFileProvider specified location, download it from EmbeddedFileProvider .
Tseng source share