A.dll 和 B.dll的命名空间难道也一样?如果命名空间不一样,加上命名空间就可以了。

解决方案 »

  1.   

    用命名空间加以区分namespace ns
    {
       public class CA
       {
              //
       }
    }
      

  2.   

    参考: C# 2.0: Using different versions of the same dll in one application
    如果你使用的是两个命名空间也是一样的dll,比如两个不同版本的dll文件,可以使用外部别名:: 运算符,如下示例extern alias oldVer;
    extern alias newVer;
    using System;
    using System.Text;
    namespace ClientApp
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.WriteLine(oldVer::MyLibrary.MyClass.method());
                Console.WriteLine(newVer::MyLibrary.MyClass.method());
            }
        }
    }然后用命令行定义外部别名csc /r:oldVer=Somepath\ClassLibrary.dll /r:newVer=AnotherPath\ClassLibrary.dll program.cs
      

  3.   

    动态加载?
    如果是托管dll,就用反射assembly加载dll,同时切换dll时可以通过appdomain卸载