Bil*_*ers 11 asp.net-core-mvc asp.net-core
我试图在ASP.NET Core项目中使用资源(.resx)文件.我使用namedResource在rc1中工作,但似乎无法在RTM中使用它.这是我的project.json的样子:
"buildOptions": {
"embed": {
"include": [ "Resources/resource.resx" ]
}
}
Run Code Online (Sandbox Code Playgroud)
我正在这样访问它:
Resources.ResourceManager.GetString("Field1");
Run Code Online (Sandbox Code Playgroud)
似乎资源没有嵌入,因为我调试时什么也没有.
任何帮助将非常感激.
小智 1
对于资源使用中的字符串:删除嵌入。
var x = ResourceFoo.Field1;
Run Code Online (Sandbox Code Playgroud)
对于资源使用中的文件:包括文件的嵌入(例如:/Folder1/**/*)Assembly.GetExecutingAssembly().GetManifestResourceStream("Folder1.Folder2.file.ext");
| 归档时间: |
|
| 查看次数: |
8226 次 |
| 最近记录: |