Resource file code not generated

Interestingly, I had similar situation today. I will share the scenario and solution here because I think it's related to your question.

I wanted to have a resource file for Arabic culture only, SharedResources.ar.resx, and I don't have another resource called SharedResources.resx.

The solution was to create the resource file with single [dot] in it, then rename it.

For example, in my case, I created the file with this name, SharedResources-ar.resx. Then double click and change its access modifier to public using the editor, like this:

enter image description here

This will generate .cs file with the correct static properties. After that, rename the file to the correct format. SharedResources.ar.resx. Otherwise it will not be generated!

I don't know if it's a good solution, but solve my problem and hope to solve someone's else too.


Yes, Designer resx file remains empty. you should follow the below steps, it will work 100%. 1) Create Resource.resx file under any folder

2) set CustomTools = PublicResXFileCodeGenerator and Build Action = Embedded Resource in Resource.resx file property.

3) Now create the different language files like below, Resources.en-US.resx Resources.nl-NL.resx etc

4)If MVC, in your MVC Model refer this namespace as project.folder

5) change the one of the property as below (example)

 [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MMM/yyyy}"), Display(Name = "dtMovinDate",ResourceType = typeof(Resources.Resource))]
            public DateTime dtMovinDate { get; set; }

6)

 In config file add this under System.web

    <globalization enableClientBasedCulture="true" culture="en-US" uiCulture="en-US" />

7) rebuild the project and test it.

It will work. The real reason of designer.cs file empty is resource designer.cs will refer these files based on your web.config file.


hello @TRS you may be confused about that there is a Designer.cs present For Resources.resx and there should be someDesigner.cs for Resources.de-DE.resx but this is not the case because designer file would be same for all the resource files. and also the property that is created in Designer.cs is also common that means you will use this property for every conversion so the difference that you can make is on the basis of ResourceCulture.