I'm working on an ASP.NET MVC 2 application and use a seperate class library for my model. I used resource files in my class library project to embed validation messages and use it in my meta data classes and everything was Ok till I decided to add a new language to my project so I renamed Resource.resx to Resource.en-US.resx and also copied and saved it as a new Resource.fa-IR.resx for another language but after renaming it, everything in Designer.cs companion file has been gone and I can't access Resource file anymore. As soon as I remove the language name (e.g. en-US) from filename it works properly.
I have already set Access Modifier to Public but no result.
I'm using Visual Studio 2008 SP1.
Don't rename resources.resx: instead, just add resource files for the additional cultures you need.
Resources.resx contains the "neutral" resources which will be compiled into your main assembly, and used as a fallback if no satellite assembly for the required culture is located.
Each additional resource file, e.g. Resource.fa-IR.resx will normally be compiled into a culture-specific satellite assembly.
You can also add to your AssemblyInfo.cs the NeutralResourcesLanguageAttribute, which informs the ResourceManager of the language you have used for the neutral resources:
assembly: [System.Resources.NeutralResourcesLanguage("en-US")]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With