Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Designer resx file remains empty after adding New Resource File


What I have tried:

1) Hi There,

I am working on a Globalization Project,

For English Translation i have added default Resource.resx file.

For other language(Japanese) i have added another resource file as Resource.ja.resx file.

When i generate Designer file for the Japanese resource file(Resource.ja.resx) its remain empty

Below Steps I have follwed to resolved but still i am unable to generate Designer files code.

1) set CustomTools = PublicResXFileCodeGenerator and 

Build Action = Embedded Resource in Resource.resx file property (Not working)

2) When i Rename "Resource.ja.resx" to "Resource.ja1.resx" its able to generate Designer File with code , Which i thing is the not propper way to call resource.
Posted
Updated 10-Aug-20 5:46am

1 solution

Either:
1. Resource designer.cs connection with your web.config file is not correctly setup OR
2. Designer file name has an extra dot

Try the following:
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)
C#
[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
HTML
<globalization enableClientBasedCulture="true" culture="en-US" uiCulture="en-US" />

7) rebuild the project and test it.
Similar discussion, where it is referenced from: c# - designer resx file remains empty - Stack Overflow[^]

If above does not work, try if it has filename issue[^]. As mentioned there, to fix this you simply need to remove the dot from the resource filename, i.e. rename Diag.Gps.resx to DiagGps.resx.

Additional Resource: Create resource files for .NET apps | Microsoft Docs[^]
 
Share this answer
 
v2
Comments
Member 14887481 10-Aug-20 12:07pm    
Hi Sandeep , I tried all the sugestion mention above, Can you plese explain the 5th Point(change the one of the property as below (example)) exactly where i can change this setting.
Sandeep Mewara 10-Aug-20 12:31pm    
This is setup at the properties that are tied to localization. To start with if you don't have such fields, you can ignore it. Concentrate on strings.
Member 14887481 11-Aug-20 0:10am    
I tried whatever u have mentioned but still i am unable to generate Designer files code.
if i rename the resource file as "Resource.ja1.resx" then its generating the Designer file code.
Sandeep Mewara 11-Aug-20 0:12am    
I had tried what documentation shares and it works out. Would suggest start with small sample if you are trying that directly in your app. See if you get that working to refer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900