Andrew Connell

Want to get the June 2005 Release (v1.1) of the Enterprise Library into the GAC?

I did! In creating an assembly that will tap the SharePoint Document Library Event Sink, I needed to get the Enterprise Library into the GAC so we wouldn’t have to copy the DLL’s to every SharePoint virtual server /bin directory as my assembly is using the Configuration, Data, Exception Handling, and Logging application blocks. Amazingly, I was surprised that the Enterprise Library wasn't strongly named OOTB. No biggie... until I saw how they coded the AssemblyInfo.cs files in each project. Every single AssemblyInfo.cs file contained a AssemblyKeyFile attribute with no set keypair file. Each project also contained a reference to the shared GlobalAssemblyInfo.cs file. Not sure what the reasoning was to adding the empty attribute, but the easy fix was to remove that attribute from every project. After that was complete, I had to add that key to the GlobalAssemblyInfo.cs file and specify the key I created. So that's it right? Nope, when you try to build, you'll get an error: error CS1577: Assembly generation failed -- Referenced assembly 'Interop.MSDASC' does not have a strong name. Damn... that's unfortunate. The reason why is the Configuration.Design project referenced a COM object. In order for an assembly to be strongly named,...

I did! In creating an assembly that will tap the SharePoint Document Library Event Sink, I needed to get the Enterprise Library into the GAC so we wouldn’t have to copy the DLL’s to every SharePoint virtual server /bin directory as my assembly is using the Configuration, Data, Exception Handling, and Logging application blocks. Amazingly, I was surprised that the Enterprise Library wasn’t strongly named OOTB.

No biggie… until I saw how they coded the AssemblyInfo.cs files in each project. Every single AssemblyInfo.cs file contained a AssemblyKeyFile attribute with no set keypair file. Each project also contained a reference to the shared GlobalAssemblyInfo.cs file. Not sure what the reasoning was to adding the empty attribute, but the easy fix was to remove that attribute from every project. After that was complete, I had to add that key to the GlobalAssemblyInfo.cs file and specify the key I created.

So that’s it right? Nope, when you try to build, you’ll get an error: error CS1577: Assembly generation failed – Referenced assembly ‘Interop.MSDASC’ does not have a strong name.

Damn… that’s unfortunate. The reason why is the Configuration.Design project referenced a COM object. In order for an assembly to be strongly named, all it’s referenced assemblies must be strongly named as well. How do you strongly name the referenced assemblies. MS KB #313666 helps out here: all you need is to add a wrapper key file.

Once that’s complete, build the solution and now you’ve got yourself a strongly named Enterprise Library v1.1!

Andrew Connell
Founder & Chief Course Artisan, Voitanos LLC. | Microsoft MVP
Written by Andrew Connell

Andrew Connell is a web developer with a focus on Microsoft Azure & Microsoft 365. He’s received Microsoft’s MVP award every year since 2005 and has helped thousands of developers through the various courses he’s authored & taught. Andrew’s the founder of Voitanos and is dedicated to delivering industry-leading on-demand video training to professional developers. He lives with his wife & two kids in Florida.