15

I have the source for a project, but am missing the .resx file, which prevents compilation. Is there a way to re-generate a resx file for it? This is a C# project I created with Visual Studio 2010 Professional on an XP machine that I'm trying to open with Visual Studio 2012 Ultimate on a Windows 8 machine.

UPDATE

It (Resources.resx) was actually there (under Properties), so I guess "cannot be found" means: "I don't like the one you gave me."

When I mashed F6 to give it another try, I got the warning, "A custom tool 'ResXFileCodeGenerator' is associated with file 'Properties\Resources.resx', but the output of the custom tool was not found in the project. You may try re-running the custom tool by right-clicking on the file in the Solution Explorer and choosing Run Custom Tool."

also: "A custom tool 'SettingsSingleFileGenerator' is associated with file 'Properties\Settings.settings', but the output of the custom tool was not found in the project. You may try re-running the custom tool by right-clicking on the file in the Solution Explorer and choosing Run Custom Tool."

I ran "Run Custom Tool" for both Resources.resx and Settings.settings, and still get the same error and two warnings.

B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
  • 5
    Do you mean the `Resources.resx` file? If so, go to project properties, then the "Resources" tab, and there should be a big link to click to regenerate it. – Patrick Quirk Nov 13 '12 at 00:56
  • Thanks; my reply is rather lengthy, so I'm appending it to my original post. – B. Clay Shannon-B. Crow Raven Nov 13 '12 at 01:40
  • I retagged the question, as the OS/VS versions and the language weren't relevant. The same problem (and solutions) can be found using VS2008 on an XP machine with a VB.Net project. – DeanOC Nov 14 '12 at 01:02

10 Answers10

6

If you have compiled the project in the past and have the dll/exe available, you can use JetBrains' DotPeek app to export the resx XML from the assembly

Open the dll/exe in DotPeek

enter image description here

Then double-click each resource to see the XML in a window. You can then copy/paste the XML into a text editor and save as a .resx file.

Don't bother right-clicking the resource and trying the 'Save Resource to File' option, as this doesn't create the file in the same format as you see on the screen.

kkuilla
  • 2,226
  • 3
  • 34
  • 37
DeanOC
  • 7,142
  • 6
  • 42
  • 56
6

Right click and remove .resx form project right click on form and update resource manager build project run project

Milind Morey
  • 2,100
  • 19
  • 15
  • 3
    Right-click on form and update resource manager? I don't seem to have that in Visual Studio 2017? – J. Scott Elblein May 13 '19 at 02:14
  • 1
    If "form" refers to a Windows Form, this is only possible if the designer file contains all needed info. In the general case, the form's resx file contains information that does not exist anywhere else. Perhaps it works in the trivial case where you have the designer open, and manually remove .resx - presumably it can be regenerated from the information in memory. But that isn't possible if you are attempting to load a project with a form whose .resx is missing. – ToolmakerSteve May 09 '21 at 00:17
4

I know this question is a little old, but I was having problems generate the .resources.dll files and after recently changing the .NET Framework version, the .ResX files still included the old .NET Framework version. I was able to resolve this by opening the affected forms and going to "Design" -> "Localizable" and changing it to "False". Then I built the project and then changed it back to "True" and the .ResX file was regenerated.

SameOldNick
  • 2,397
  • 24
  • 33
3

I come from the future, Visual Studio 2019. I had the same issue after a bigger merging process (for some reason it asked me to merge a lot or all of *.Design files). It was apparent that somehow I had to regenerate the auto-generated Code from the .resx files.

Solution: I changed an entry (the name, not the value), saved it, changed it back, saved it. This seems to have forced a regeneration of all .resx files, and the project was compiling again.

Just do a single change that would necessitate a change in the auto-generated code.

Battle
  • 786
  • 10
  • 17
2

I had this problem on a form I created for a rather extensive project. I was able to simply copy the resx of another form, in the same project, and change the filename.

I went through over a dozen of the resx files in my project and noticed that most of them were identical; the few that were not, only differed by one or two extra lines.

Wayne
  • 477
  • 9
  • 16
1

As far as I have read there is no way to regenerate .resx file but you can go another way you can create another/same win application and all the controls aspects to it . Than take a newly created resx file and add to old project. Try it maybe it will work

COLD TOLD
  • 13,513
  • 3
  • 35
  • 52
1

Here's how I solved it: I opened the missing ancillary files (AssemblyInfo.cs, Resources.resx, Resources.Designer.cs, Settings.settings, and Settings.Designer.cs) from another project in Notepad, removed the things that didn't belong (such as the reference to ThemeEditor or some such), changed other things as necessary (the name of the app or package), and these were finally accepted as those belonging to my app.

B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
1

Visual Studio 2012-2015 users For a Web Application, simply select the Web Control (ascx) or Page (aspx) that is missing the resx in Solution Explorer and go to the Project menu and select "Convert to Web Application", press OK on the prompt. You should see the new files under the selected item in Solution Explorer.

0

copy the .resx file of any other form in the project to the project folder and try again. It worked for me.

davejal
  • 6,009
  • 10
  • 39
  • 82
0

If running VS 2017 or greater I just deleted the file.

George M
  • 63
  • 2
  • 5