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

大兔子大兔子 提交于 2021-02-08 14:10:23

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/20576156/deploying-my-dll-to-gac-references-other-dll-not-in-gac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!