I have a problem with GlobalResources
- I create App_GlobalResources folder
- Add User.resx
- Add Name = "FirstName", Value = "First name"
Default I can't use this resources in my MVC project. I tried:
- App_GlobalResources.User.FirstName - did not work
- Resources.User.FirstName - it works but only codebehind, when build and start application (local), show error:
Nie można pobrać właściwości „Name”, ponieważ lokalizacja nie powiodła się. Typ „Resources.Users” nie jest publiczny lub nie zawiera publicznej, statycznej właściwości ciągu o nazwie „FirstName”.
Which its translation is:
Unable to retrieve the properties "Name" as the location failed. Type "Resources.Users" is not a public or does not contain a public static property within named "FirstName."
Then I change User.resx properties:
- Build Action: Embedded Resource
- Copy to output: Directory Do not copy
- Custom Tool: PublicResourceProxyGenerator
- Custom Tool Namespace: "empty"
Now I can't use Resources.User.FirstName I have to useApp_GlobalResources.User.FirstName
I'm happy it's work. But yesterday is my first publish on the test server and resourses not working...
File does't copy to server...
I change User.resx properties
- Build Action: Content
- Copy to output: Directory Do not copy
- Custom Tool: GlobalResourceProxyGenerator
- Custom Tool Namespace: "empty"
Copy files but the application throws the same previous exception which I shared above and resources not work in localmachine, any advice?