代码之家  ›  专栏  ›  技术社区  ›  kateroh

向C#项目添加依赖项-不同版本的相同程序集

  •  0
  • kateroh  · 技术社区  · 15 年前

    我需要能够从位于GAC的同一程序集的不同版本调用实用程序:

    gacutil /l TestAssembly  
      TestAssembly.dll, Version=1.0.0.0 ....  
      TestAssembly.dll, Version=2.0.0.0 ....  
    

    TestObject testObject;
    if (loadFromVersion1)  
    {  
        testObject = // instantiate test object from the first assembly  
    }  
    else  
    {  
        testObject = // instantiate test object from the second assembly  
    }  
    

    有没有一种方法可以不用反射(我知道如何用反射来实现这一点)而改用强类型对象?

    1 回复  |  直到 15 年前
        1
  •  1
  •   GBegen    15 年前

    我想你在找 extern alias