使用两个.NET库具有相同的命名空间两个、空间、NET

2023-09-04 12:41:54 作者:他才是你的唯一

我目前保持一些旧的code为一家公司。由于它会发生,当前的应用程序,我修改使用内部库的旧版本(我们称之为Lib1.dll)。他们也有叫Lib2.dll库,提高了于previous库在许多方面的新版本。

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.

不幸的是,LIB2不向后兼容LIB1。更糟糕的是,它们都使用相同的命名空间Product.Common。

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

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

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

我使用VB.NET 1.1。

I'm using VB.NET 1.1.

推荐答案

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

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

外部别名演练 和 C#2.0:在一个应用程序中使用不同版本的同一个DLL

这似乎你的运气了。似乎没有被使用.NET 1.1的溶液中。

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