views:

200

answers:

1

My company uses a combination of some database tables, a web page front end and an "export" application to handle our string resources in our web sites.

The export application used to work just fine when we used VS2008, but since switching to VS2010 the resources now have a designer.cs file "beneath" them in the solution explorer.

The problem is that the "export" application only generates the .resx files and not the underlying designer.cs files.

So, is there a way to not have those designer.cs files, or alternatively some way to automatically re-generate (or even some command the export application could call to re-generate them)

+1  A: 

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.

Leniel Macaferi
thanks, sometimes it's just knowing what to search for :)I will look into that on monday morning.
Antony Scott
fantastic, I just changed my export app to run the resgen tool if there was also a .designer.cs file (> 0 bytes) in the same folder as the .resx file.(I couldn't wait until Monday, curiosity got the better of me)
Antony Scott
hmm, this didn't quite work correctly. It compiled just fine but the application crashed when I ran it. So, I've tried a different approach which almost works. I've started a new question, because it's a slightly different problem.http://stackoverflow.com/questions/3230585/run-custom-tool-for-resx-files-in-mvc2-project-from-an-external-application-sc
Antony Scott