Asp.net mvc 从razor视图访问Properties文件夹中的Resources.resx文件
从ASP.NET MVC应用程序中的cshtml视图中,我尝试访问Resources.resx文件中的字符串,但未成功 Resources.resx文件位于Properties文件夹中: MyProject->Properties->Resources.resx 它具有以下属性集:Asp.net mvc 从razor视图访问Properties文件夹中的Resources.resx文件,asp.net-mvc,razor,Asp.net Mvc,Razor,从ASP.NET MVC应用程序中的cshtml视图中,我尝试访问Resources.resx文件中的字符串,但未成功 Resources.resx文件位于Properties文件夹中: MyProject->Properties->Resources.resx 它具有以下属性集: Build Action: Embedded Resource Custom Tool: PublicResXFileCodeGenerator Custom Tool Namespace is not set (
Build Action: Embedded Resource
Custom Tool: PublicResXFileCodeGenerator
Custom Tool Namespace is not set (left blank)
另外,在顶部VisualStudio的Resources Designer中,我将Access修饰符的组合框值从内部更改为公共。但它仍然不起作用
从我的视图cshtml导入资源:
@using MyCompany.MyProject.Resources
@using MyCompany.MyProject.Resources
然后我使用以下语法:
@Resources.MyLabel
我已检查,但它不起作用。我已通过导入正确的命名空间解决了此问题:
@using MyCompany.MyProject.Properties
而不是: