Scott Allen has a great post explaining how resource files work in ASP.Net MVC project using Visual Studio. Technically speaking, this also applies to ASP.Net Web Form.
Basically, there are these problems:
- Placing resource files in App_GlobalResources folder will break unit tests.
- Intellisense has trouble recognizing syntax in the Views.
- App_LocalResources seems to have similar behavior.
The solution is ostensibly simple. Just put resource files in a separate folder, name it anything you want. This will:
- Embed the resource files in library when the project is compiled.
- The generated class is internal by default. This is can be changed if you need to share the class publicly.
To change generated class to public, change ‘Custom Tool’ property of the resource file to ‘PublicResXFileCodeGenerator’ instead of ‘ResXCodeFileGenerator’.