ResXFileCodeGeneratorEx and Visual Studio 2008

Date Published: 28 January 2008

ResXFileCodeGeneratorEx and Visual Studio 2008

A couple of months ago I found a great Extended Strongly Typed Resource Generator that would let me use Resource files in shared libraries (Brendan blogged about it and set it up). The default resource generator in Visual Studio generates code that is marked with the internal keyword, making it difficult to share the resources between assemblies or projects. The Extended Strongly Typed Resource Generator avoids the problem and adds some other enhancements that make it a great tool. However, at present it doesn’t work with Visual Studio 2008.

There’s a fix that will get you partway there. I found it in a comment on the CodeProject version of the code, and I’ve included it below:

we need to change the path from
@”SOFTWAREMicrosoftVisualStudio8.0Generators{0}{1}”
to
@”SOFTWAREMicrosoftVisualStudio9.0Generators{0}{1}”
inside method “registryKeyPathBuilder” in registryKeyPathBuilder.cs file and all working fine

Make this change to the source project, and you’ll at least be using the right path for VS2008. However, then you’ll run into a nasty VS2008 bug:

“The assembly ‘Microsoft.VisualStudio.Shell.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ is not registered for COM Interop. Please register it with regasm.exe /tlb.”

This is described in this forum thread, and apparently it’s a known issue that will be fixed in SP1, and in the meantime you can get a hotfix if you contact Ed Dore of Microsoft. I’m sending him an email now and hope to have a fix soon, but in the meantime I’m keeping VS2005 around so that I can compile my resource files using this tool.

Steve Smith

About Ardalis

Software Architect

Steve is an experienced software architect and trainer, focusing on code quality and Domain-Driven Design with .NET.