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