开发者

Redirect application to use another assemlby with different name

My .Net C# appliation is referencing a strong named dll,and my requiremnet is to redirect the application to use another dll with a different name ( version and开发者_如何转开发 key are same for both dlls), how can i achive this without recompiling the application.


Here is the offical doc on this: Redirecting Assembly Versions (check out the "Specifying Assembly Binding in Configuration Files" section, this is the most easy to do)


Reflection might be a solution.

At the point you know what dll you want to use pull in the dll by reflection.

If both dlls derive from the same interface then the rest of the code can be very generic no matter the dll you use.


You can't as far as i know. That's the beauty of it, strong named assemblies are produced with a signature, precisely to avoid what you're trying to do.

After all it wouldn't have much security if you could just substitute a DLL from another one and having the new DLL methods do whatever you want under the original caller context would it?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜