Do I need the resx Designer.cs file?

I had a problem where VS 2010 would not regenerate the Designer.cs files, and couldn't find the solution elsewhere.

I was able to regenerate them though, without going to the command line.

To fix the issue in Visual Studio 2010 I did the following:

  1. Deleted the Designer.cs file
  2. Right clicked on the main resx file
  3. Selected Run Custom Tool

That rebuilt the Designer.cs file.

Hope that might help someone else in the future..


From MSDN we have:

Compiling Resources into Assemblies

When you build your application, Visual Studio invokes the resgen.exe tool to convert your application resources into an internal class called Resources. This class is contained in the Resources.Designer.cs file which is nested under the Resources.resx file in Solution Explorer. The Resources class encapsulates all your project resources into static readonly get properties as a way of providing strongly-typed resources at run-time. When you build through the Visual C# IDE, all the encapsulated resource data, including both the resources that were embedded into the .resx file and the linked files, is compiled directly into the application assembly (the .exe or .dll file). In other words, the Visual C# IDE always uses the /resource compiler option. If you build from the command line, you can specify the /linkresource compiler option that will enable you to deploy resources in a separate file from the main application assembly. This is an advanced scenario and is only necessary in certain rare situations.