Public Class for Strongly Typed Resource Wrapper in Visual Studio 2005.

time to read 1 min | 169 words

I asked yesterday how you can solve this problem, since the ResXFileCodeGenerator output internal classes only. This is a little bit more complex than using the VS built-in tools, but I think that it's worth the effort. First, I would like to thank Laurent Docquir for giving me 95% of the answer.

It all boils down to this:

resgen GridCommands.resx /publicClass /str:C#,,GridCommands,GridCommands.Design.cs

 

Replace the GridCommands with your own resource file names, and put it in the project pre-build action. This will make sure that they are built as public, so you can access it.

 

There is a request on LadyBug to add it, which I hope they would put into the service pack for VS 2005.

 

There is still a problem with doing it for each and every resource file, and you don't get instantenous action, only after compile, but that should be good enough, I think.