Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying My DLL To GAC, References Other DLL Not In GAC

I am building a class library. This library will be deployed to the GAC.

In my library, I have references to some external dependencies. The dependencies cannot be deployed to the GAC.

When I deploy my library, and use it, it complains that it can't load the dependencies.

How do I deploy the third-party DLLs so my assembly can reference them?

like image 624
CamronBute Avatar asked Dec 13 '13 21:12

CamronBute


1 Answers

To add an assembly to the GAC, you don't need to have all the references of that assembly into the GAC as well. So as long as the application that is using your assembly can find all the references it is no problem.

So either deploy all the assemblies privately (in the same folder as the application) or deploy them into that GAC and deploy only that exchange assembly privately.

UPDATE

The same rules apply if you're not the one building the application, but are just providing a library.

There is no way you can have another central folder which acts like the GAC but is not the GAC.

The users of your library should deploy at least that assembly privately with their application. That is no problem if you just provide the library and the users of your library do the deployment.

You can't provide an installer and have all applications use your library without at least requiring them to provide that assembly with the application. Usually that is not a problem for a .Net application. Not using the GAC makes installing basically 'xcopy deployment'.

Of course the other solution would be not depending on that assembly.

like image 72
Lars Truijens Avatar answered Oct 20 '22 14:10

Lars Truijens