在.net Core 1.0中使用resx资源



我试图在ASP中使用资源(.resx)文件。. NET Core项目。我使用命名资源在rc1中工作,但似乎无法在RTM中工作。这是我的项目。Json看起来像:

"buildOptions": {
  "embed": {
    "include": [ "Resources/resource.resx" ]
  }
}

我像这样访问它:

Resources.ResourceManager.GetString("Field1");

似乎资源没有嵌入,因为当我调试时没有任何东西。

对于资源使用的字符串:删除嵌入。

var x = ResourceFoo.Field1;

对于资源使用的文件:包含嵌入文件(例如:/Folder1/**/*)Assembly.GetExecutingAssembly () .GetManifestResourceStream("Folder1.Folder2.file.ext");

最新更新