C#.NET的DLL参考依赖 [英] C# .Net Dll References Dependency

查看:327
本文介绍了C#.NET的DLL参考依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个DLL库 MyLIB.dll (版本的 1.0.0 的)依赖于第三方的DLL库 OtherLIB.dll (版本的 1.0.0 的)。库 OtherLIB.dll 可在的NuGet,我将它添加到 MyLIB.dll 通过的NuGet包管理器的项目。

I have written a DLL library MyLIB.dll (version 1.0.0) that depends on the third party DLL library OtherLIB.dll (version 1.0.0). Library OtherLIB.dll is available on the NuGet and I'm adding it to the MyLIB.dll project via NuGet package manager.

现在让我们说,我正在写一个新的应用程序,比如 MyAspNetMvcApp 和我添加的 MyLIB.dll (版本的 1.0.0 )将其通过的NuGet。它会自动添加 OtherLIB.dll (版本的 1.0.0 的),因为它依赖于它。一切工作正常,但...

Now let's say that I'm writing a new application, say MyAspNetMvcApp and I'm adding MyLIB.dll (version 1.0.0) to it via NuGet. It automatically adds OtherLIB.dll (version 1.0.0) as it depends on it. Everything is working fine, but...

经过一个月有被释放的 OtherLIB.dll 一个新的版本 - 版本的 1.0.1 的。我经过的NuGet更新它。

After a month there is being released a new version of OtherLIB.dll - version 1.0.1. I'm updating it via NuGet.

现在,我的ASP.NET MVC应用程序停止工作,因为那里是 MyLIB.dll 抛出异常。该公司预计的 OtherLIB.dll 版本的 1.0.0 的但已被使用。新版本

Now, My ASP.NET MVC application stops working because there is being thrown an exception by MyLIB.dll. It expects OtherLIB.dll in version 1.0.0 but there is already newer version being used.

MyLIB.dll 项目引用我可以看到,特定版本标志的 OtherLIB.dll 被设置为假,所以我不知道什么是怎么回事?

In MyLIB.dll project references I can see that "Specific Version" flag for OtherLIB.dll is being set to "False", so I have no idea what's going on here...

是否有可能解决这个问题,在其他方式比通过提供装配在web.config文件绑定?我怎样才能添加的引用 OtherLIB.dll MyLIB.dll 以这种方式,将不会有当我更新异常 OtherLIB.dll 到更新的版本?

Is there any possibility to solve this issue in other way than by providing assembly binding in web.config file? How can I add a reference to OtherLIB.dll for MyLIB.dll in such way that there will be no exception when I update OtherLIB.dll to a newer version?

推荐答案

我遇到了这个昨天的Visual Studio Web开发人员使用Oracle.DataAccess.dll。

I ran into this yesterday for visual studio web developer using Oracle.DataAccess.dll.

我的解决办法,

右键点击您的项目解决方案(* .csproj的),并对其进行编辑。

right click your project solution (*.csproj) and edit it.

正下方:

<PropertyGroup>

地点

<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

然后重建您的解决方案。你必须分开的两个版本的dll文件到您的项目中两个不同的目录,包括他们的时候(必填)。

Then rebuild your solution. You must separate the two version dlls into two different directories in your project when including them (required).

我做了

ora11 >> Oracle.DataAccess.dll(11版)

ora11 >> Oracle.DataAccess.dll (Version 11)

ora9 >> Oracle.DataAccess.dll(第9版)

ora9 >> Oracle.DataAccess.dll (Version 9)

这样做可以让您的IDE使用的DLL的两个版本。

Doing this allows your IDE to use both versions of DLLs.

这篇关于C#.NET的DLL参考依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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