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.
精彩评论