GuRAm
GuRAm

Reputation: 777

Resource (resx) file import

I have problem after importing resource files from one project to another.

I work with Visual Studio Ultimate 2013, C#, Visual Online.

I have Resource files in my projects. When I create a new project and import files and these resources to a new project, MY_RESOURCE.Designer.cs is not in its own MY_RESOURCE.resx section - it is next to it.


Also, in project's file (.csproj) I found, that structure of these files are different.


I found some solutions like this problem's, to change Recourse's "Access Modifier" property (in it) from "No code generation" to "Public", but after this, resx file creates new child - MY_RESOURCE1.Designer.cs (not my MY_RESOURCE.Designer.cs), so this is not solution for my problem.

So, insted of importing them, I have to create new Resource file and copy and paste the words from the old project's resource files to new one.

Can someone advice me the way to bind a Designer.cs file to resx file insted of copy-paste..?

Upvotes: 5

Views: 6941

Answers (2)

LucaMus
LucaMus

Reputation: 731

The C# code ("Main.en-US.Designer.cs") is automatically generated by VS, you have to check that Visual Studio is correctly managing your resx file. To achieve this, check the Custom Tool property for your resx file:

  1. Select your resx file
  2. Open the Properties tab
  3. Check "Custom Tool" property, make sure that "ResXFileCodeGenerator" value is present.

This should fix your issue.

Upvotes: 5

Savaratkar
Savaratkar

Reputation: 2084

I have had same issue before. I did finally the same, copy-pasting. But have you tried changing the project file. Your new project should have this node inside designer file node:

<DependentUpon>Main.en-US.resx</DependentUpon>

I would say, first import the file, then edit your project file and add this node above, in your designer file node i.e.,

<Compile Include="Resources\Main\Main.en-US.Designer.cs">

Upvotes: 1

Related Questions