5
我已經有他自己的MVC的控制面板,帶有控制器,觀點和路由的NuGet包。如何在構建Visual Studio 2017中嵌入資源文件?
這NuGet包在其他.NET核心的Web應用程序導入。
在Visual Studio的2015年,與.NET的核心,我用下面的代碼編譯意見的資源,使他們能夠通過剃刀引擎中找到,然後正確地呈現。
在project.json(的NuGet):
"buildOptions": {
"embed": "**/Views/**/*.cshtml"
}
在Startup.cs(Web應用程序):
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);
}
在Visual Studio 2017年project.json file.doesn't存在現在,我無法找到一種將我的視圖嵌入到nuget包中的新方法。
我如何嵌入我的看法?
嗨@Dmitry!我可以使用像「Views/*/*。cshtml」這樣的通配符來一次導入所有視圖嗎? –
@Carlos,我不知道,只是嘗試和分享:) – Dmitry
剛試過在VS2017:它的工作對我像'包括=「** \翻譯\資源* RESX。」'的格式 – Myobis