Sun, Jul 17 2005 12:57 AM Erwyn van der Meer

Strong naming Enterprise Library 1.1

Two weeks ago I blogged about strong naming Enterprise Library 1.1 assuming the procedure would be identical to what I did with version 1.0. Well last Friday I went ahead and repeated those steps for version 1.1.

Unfortunately I hit a snag. The compiler complained about "Referenced assembly 'Interop.MSDASC' does not have a strong name". I knew that strongly named assemblies cannot reference assemblies that don't have a strong name, so I went looking for this assembly. The reason the compiler complained was that the Configuration.Design project of EntLib references the COM Type Library MSDASC. If you reference a COM type library, Visual Studio .NET will create an interop assembly on the fly. Searching through the registry revealed that the type library MSDASC is located in oledb32.dll. I looked through the command line switches of the command line tool TlbImp to see if it would be able to create strongly named interop assemblies. It can, but it is a hassle.

So, I googled the compiler error and found a Spanish blog entry of "El Bruno". I can't read Spanish, but it had a link to the KB article with the title "PRB: "Assembly Generation Failed" Error Message When You Try to Build a Managed DLL Without a Strong Name".

This KB article contained the steps to let VS.NET do the dirty work:

1. In Microsoft Visual Studio .NET, open the properties of the Visual C# project in which you want to reference the COM component.
2. In the tree, click Common Properties, and then click General.
3. In the Wrapper Assembly Key File field, add the key file.
4. Rebuild the project.

Instead of using the Wrapper Assembly Key File field I used the Wrapper Assembly Key Name field so that VS uses the private key in the key container (imported using sn -i). Done!

Too bad that this information isn't included in the EntLib 1.1 documentation. Has nobody ever tried strong naming EntLib at Microsoft and/or Avanade before releasing version 1.1?!

Filed under: ,

# re: Strong naming Enterprise Library 1.1

Monday, July 18, 2005 3:46 AM by Ramon Smits

I also made 1.1 strongnamed. Creating a interop assembly with tlbimp isn't a hassle at all.

Just add the /keycontainer swith to it with the proper containername and your done.

This results in a strongtyped interop assembly which I then referenced from the only project in 1.1 that used it.

# re: Strong naming Enterprise Library 1.1

Monday, July 18, 2005 4:04 AM by Erwyn van der Meer

Ramon, I consider looking for the correct DLL, opening a Visual Studio command prompt, going to the correct folder, looking up the correct command line arguments, worrying if tlbimp will put everything in the correct namespace, worrying about all the warnings that tlbimp produces, copying the output DLL, referencing it, putting in under source control so other can build EntLib from SourceSafe without performing these steps, a hassle.

# re: Strong naming Enterprise Library 1.1

Monday, July 18, 2005 6:34 PM by Erik Tinselboer


I've used tlbimp many times, its very simple and gives you control over how you'd like the interop assembly generated. The interop generation can also be added to a script to be executed during automated builds, etc.

# re: Strong naming Enterprise Library 1.1

Tuesday, July 19, 2005 4:46 AM by Erwyn van der Meer

Erik, I do appreciate the power and control of tlbimp. But in this case EntLib, as provided by Microsoft without an automated build outside of VS.NET, uses the "default" interop generation in the IDE. I wanted to modify as little as possible for strong naming EntLib.

# re: Strong naming Enterprise Library 1.1

Thursday, August 04, 2005 3:49 AM by El Bruno

So .. I have this problem when I tried to strongname the complete EntLib solution ...
you are right, they must probably add this kind of solution to the EntLib documentation ...

Bye from Spain
El Bruno

# Building Enterprise Library 1.1 with Strong-Named Assemblies

Wednesday, December 07, 2005 3:35 PM by Josh Meyer

# re: Strong naming Enterprise Library 1.1

Wednesday, September 13, 2006 4:42 AM by Ramalingam

that last paragraph questioning the quality of the pre-release team at MicroSoft was simply too good.! hats off dude :)