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: .NET, Architecture and Design