How-To: Copy A Dependent Assembly If It Is Not In The GAC?

I am creating an installation package using VS2008. This is a regular installation package that installs the Outlook COM Add-in application. It works OK so far. However, I need to improve it a bit ...

The story is that the installation package copies all dependent assemblies to the add-in installation folder.

For example, a COM add-in depends on the assembly Microsoft.Office.Interop.Outlook.dll. Thus, the installation package copies it to its own folder:

Of course, I can switch the Exclude property of the Microsoft.Office.Interop.Outlook.dll dependency to True, which will prevent the assembly from being copied. However, I need to do the following behavior:

  • If Microsoft.Office.Interop.Outlook.dll is not in the GAC, we will just copy it to the add-in installation folder
  • Otherwise use the one in the GAC

Please suggest a way ti can be done in .Net2.0? A walkthrough would be really appreciated.

+1


source to share


1 answer


Just copy it to a folder. If it's already in the GAC, the GAC'd assembly will be used anyway.

In other words, the runtime checks the GAC first. Then it checks the application base, etc.



http://msdn.microsoft.com/en-us/library/yx7xezcf(VS.71).aspx

+2


source







All Articles