【发布时间】:2020-02-11 15:16:59
【问题描述】:
从我的 ASP.NET MVC 应用程序中的 cshtml 视图中,我尝试访问 Resources.resx 文件中的一个字符串,但没有成功。
Resources.resx 文件位于 Properties 文件夹中:
MyProject -> 属性 -> Resources.resx
它具有以下属性集:
Build Action: Embedded Resource
Custom Tool: PublicResXFileCodeGenerator
Custom Tool Namespace is not set (left blank)
此外,在顶部 Visual Studio 的资源设计器中,我已将访问修饰符的组合框值从内部更改为公共。但是还是不行……
在我看来 cshtml 我导入了资源:
@using MyCompany.MyProject.Resources
然后我使用以下语法:
@Resources.MyLabel
我检查了this,但它不起作用。
【问题讨论】:
标签: asp.net-mvc razor