I have a nuget package that has its own mvc control panel, with controllers, views and routes.
This nuget package is imported into other .net web applications.
In Visual Studio 2015 with the .net core, I used the following code to compile views as resources, allowing them to be found using the razor mechanism and then displayed correctly.
In project.json (nuget):
"buildOptions": { "embed": "**/Views/**/*.cshtml" }
In Startup.cs (web application):
public void ConfigureServices(IServiceCollection services) { services.Configure<RazorViewEngineOptions>(options => { options.FileProviders.Add(new CompositeFileProvider( new EmbeddedFileProvider( typeof(HomeController).GetTypeInfo().Assembly, "Some.Namespace")) ); }); return new IuguPortalBuilder(services); }
In Visual Studio 2017, the project.json file.doesn't exist anymore, and I cannot find a new way to embed my views in the nuget package.
How can I embed my views?
source share