TechnicalArchitectureWorx

The (Unofficial) ITWorx Technical Architecture Blog

How to add Microsoft Enterprise Library (June 2005) to GAC?

Posted by archworx on March 28, 2007

You may need to add the enterprise library to GAC in case that you want to share it across more than one application in a production server, the enterprise library is a set of dlls, you should sign all those dlls in order to be added to the GAC. So, you should follow the following steps:

1- open the command prompt and type “sn -k c:\mykey.snk” to generate key file which will be used to sign the assemblies.

2- Open the enterprise library solution in the Visual Studio.

3- Open the Caching Project.

4- Open the GlobalAssemblyInfo.cs shortcut in the Caching project.

5- Add the following line [assembly: AssemblyKeyFile(“c:\\mykey.snk”)]

6- Make sure that you don’t have any “AssemblyKeyFile” attributes in the assemblyinfo.cs of each project, other wise you will get a compilation errors.

7- copy \Program Files\Common Files\System\Ole DB\oledb32.dll to c:\

8- generate the signed interop assembly using the following command: tlbimp /keyfile:c:\mykey.snk c:\oledb32.dll

9- the above command will generate “MSDASC.dll” which is the primary interop assembly for the oledb32 com

10- open the Configuration.Design Project

11- delete “MSDASC” from the references

12- add new reference to the generated signed MSDASC.dll

13- You must Compile the project with reference of the signed enterprise library dll’s in order to make your application can access the signed library from GAC.

NOTE: You must add the public key token used to sign the Library in the configuration file as dataconfiguration.config or the exceptionhandlingconfiguration.config or else you will get a security exception thrown in the log file and application will not work

3 Responses to “How to add Microsoft Enterprise Library (June 2005) to GAC?”

  1. Southport, North Carolina  <  NC Coastal Community along the Cape Fear River and Intracoastal Waterway >

    Useful, thank you!

  2. Cialis said

    xm2ISa Excellent article, I will take note. Many thanks for the story!

  3. Website said

    Website…

    How to add Microsoft Enterprise Library (June 2005) to GAC? « TechnicalArchitectureWorx…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: