How do I deploy dlls to a system's GAC and check for their existence on program startup?

Entity Framework references some DLLs. On one system, they showed up in the GAC which is very convenient. I can't figure out how I did this. The installer doesn't seem to do this --

The dlls I'm specifically talking about here are:

  • The core library assembly Microsoft.Practices.EnterpriseLibrary.Common.dll
  • The Unity Application Block assembly Microsoft.Practices.Unity.dll
  • The Object Builder assembly Microsoft.Practices.ObjectBuilder2.dll

but I guess it applies to any dll one might want to add to the GAC. Also is there a way to check on program startup whether an assembly even is in the GAC?

Answers


Check if is in the GAC:

bool inGac = System.Reflection.Assembly.Load(assemblyName).GlobalAssemblyGac;

To install in gac, there's a question Methods to programmatically install a .NET assembly into the GAC


Need Your Help

Arrange 0's & 1's in a array

algorithm language-agnostic

This is one of an interview question which I had recently. I would like to know others perception of approach for this problem.

Avoid casting to access specialized member of a derived class

c++ oop inheritance encapsulation

In our code, we have a physical problem (to be solved) which encapsulates a medium (fluid or solid for example).