使用两个具有相同命名空间的.NET库 [英] Using two .NET libraries with the same namespace

查看:198
本文介绍了使用两个具有相同命名空间的.NET库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为一家公司维护一些旧的代码。这样会发生,我正在修改的当前应用程序使用旧版本的内部库(我们称之为Lib1.dll)。他们还有一个名为Lib2.dll的新版本的库,它以许多方式改进了以前的库。



不幸的是,Lib2不能向后兼容Lib1。更糟糕的是,他们都使用相同的命名空间Product.Common。



如何在同一个项目中使用Lib2和Lib1?现在,如果我添加对它们的引用,VS会告诉我某些类是不明确的(这是有道理的,因为它们使用相同的命名空间)。



基本上,我需要这样的东西:

 导入Lib1:Product.Common.Class 

我正在使用VB.NET 1.1。

解决方案

发现一个博客条目在C#中有一个解决方案,不知道在VB.NET中的解决方案。



Extern别名演练

C#2.0:在一个应用程序中使用不同版本的同一个DLL






编辑:



似乎你没有运气。似乎没有.NET 1.1的解决方案。


I'm currently maintaining some old code for a company. As it would happen, the current app I'm modifying uses an older version of the in-house library (we'll call this Lib1.dll). They also have a new version of the library called Lib2.dll that improves upon the previous library in many ways.

Unfortunately, Lib2 is not backward compatible with Lib1. What's worse is that they both use the same namespace Product.Common.

How do I use Lib2 and Lib1 in the same project? Right now if I add references to both of them, VS tells me that certain classes are ambiguous (which makes sense, since they using the same namespace).

Basically, I need something like:

Imports Lib1:Product.Common.Class

I'm using VB.NET 1.1.

解决方案

I found a blog entry that has a solution in C#, not sure of the solution in VB.NET.

Extern alias walkthrough and C# 2.0: Using different versions of the same dll in one application


Edit:

It would seem you are out of luck. There does not appear to be a solution with .NET 1.1.

这篇关于使用两个具有相同命名空间的.NET库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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