开发者

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

开发者 https://www.devze.com 2023-01-14 15:36 出处:网络
I need to be able to call utilities from different versions of the same开发者_如何学运维 assembly both residing in GAC:

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

精彩评论

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