.netresx

Is there a way to regenerate a missing .resx file?


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.


Solution

  • 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.