Open visual studio and create a Class Library Project.
You need to download and add the static content you would like to host in the embedded file system.
As a convention it is a good practice to store the files under the folder named: Assets
You can use the following line in your project file to embedd multiple files:
<ItemGroup> <EmbeddedResource Include="Assets\**\*.PNG; Assets\**\*.html; Assets\**\*.jpg; Assets\**\*.ico; Assets\**\*.svg; Assets\**\*.css; Assets\**\*.js " Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup>
In your web application use the following code in your startup class to create a simulated file system that points to the Assets library in your Class Library project.
//mark the composite providers preferably not one by one, but together at once var webOriginalProvider = _env.WebRootFileProvider; var embeddedProvider = new EV5EmbeddedFileProvider(typeof(SamplesEmbeddedPlugin).Assembly, "EV5.Samples-"); var webCompositeProvider = new CompositeFileProvider(webOriginalProvider, embeddedProvider); _env.WebRootFileProvider= webCompositeProvider; var contentOriginalProvider = _env.ContentRootFileProvider; var contentCompositeProvider = new CompositeFileProvider(contentOriginalProvider, embeddedProvider); _env.ContentRootFileProvider = contentCompositeProvider;Here you are specifying that the "EV5.Samples-" prefix will refer to the embedded resources inside your dll.
To create a link to an embedded resource, such as an image file, you have to start with the registered path: "/EVE.Mvc.Samples.Embedded/Assets" and then follow with the file location inside the Assets folder in your project : "/LandingPage/img/ipad.png". Here is the link code to this image:
<img src="/EV5.Samples-Assets.LandingPage.assets.img.team.1.jpg" style="height: 30px;">