将我的DLL部署到GAC,引用了不在GAC中的其他DLL [英] Deploying My DLL To GAC, References Other DLL Not In GAC

查看:76
本文介绍了将我的DLL部署到GAC,引用了不在GAC中的其他DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个类库.该库将部署到GAC.

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

在我的库中,我引用了一些外部依赖项.依赖项无法部署到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.

如何部署第三方DLL,以便我的程序集可以引用它们?

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

推荐答案

要将程序集添加到GAC,您也不需要将该程序集的所有引用都添加到GAC中.因此,只要正在使用程序集的应用程序可以找到所有引用,就没有问题.

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.

因此,要么私下部署所有程序集(与应用程序位于同一文件夹中),要么将它们部署到该GAC中,然后私下仅部署该交换程序集.

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.

更新

如果您不是构建应用程序的人,而只是提供一个库,则适用相同的规则.

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

您不可能有另一个中央文件夹,其作用类似于GAC,但不是GAC.

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.

您不能提供安装程序,并且要所有应用程序都使用您的库,而至少不要求它们向应用程序提供该程序集.通常,对于.Net应用程序来说,这不是问题.不使用GAC会使安装基本上是"xcopy部署".

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.

这篇关于将我的DLL部署到GAC,引用了不在GAC中的其他DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆