Microsoft MVP Logo

    <p>I did!&nbsp;In creating an assembly that will tap the <a title="" href="http://www.microsoft.com/office/sharepoint/prodinfo/overview.mspx" target="_blank">SharePoint</a> Document Library Event Sink, I needed to get the <a href="http://www.gotdotnet.com/codegallery/codegallery.aspx?id=295a464a-6072-4e25-94e2-91be63527327">Enterprise Library</a> into the GAC so we wouldn&rsquo;t have to copy the DLL&rsquo;s to every SharePoint virtual server <span class="inline-code">/bin</span> directory as my assembly is using the Configuration, Data, Exception Handling, and Logging application blocks.&nbsp;Amazingly, I was surprised that the Enterprise Library wasn't strongly named OOTB.&nbsp; </p>
    <p>No biggie... until I saw how they coded the <span class="inline-code">AssemblyInfo.cs</span> files in each project. Every single <span class="inline-code">AssemblyInfo.cs</span> file contained a <span class="inline-code">AssemblyKeyFile</span> attribute with no set keypair file. Each project also contained a reference to the shared <span class="inline-code">GlobalAssemblyInfo.cs</span> 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 <span class="inline-code">GlobalAssemblyInfo.cs</span> file and specify the key I created.</p>
    <p>So that's it right?&nbsp; Nope, when you try to build, you'll get an error: <span class="inline-code">error CS1577: Assembly generation failed -- Referenced assembly 'Interop.MSDASC' does not have a strong name</span>.</p>
    <p>Damn... that's unfortunate.&nbsp; The reason why is the <span class="inline-code">Configuration.Design</span> project referenced a COM object.&nbsp; 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. <a href="http://support.microsoft.com/Default.aspx?kbid=313666">MS KB #313666</a> helps out here: all you need is to add a wrapper key file.</p>
    <p>Once that's complete, build the solution and now you've got yourself a strongly named Enterprise Library v1.1!</p>
Comments powered by Disqus