开发者

Adding dependencies to C# project - same assemblies of different versions

I need to be able to call utilities from different versions of the same开发者_如何学运维 assembly both residing in GAC:

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

And somewhere in code I need to dynamically load either one:

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

Is there a way to do this without reflection (i know how to accomplish this with reflection) and use strongly typed objects instead?


I think you are looking for extern alias.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜