开发者

assemblyBinding in .NET app works with old version if new version is not available?

I've specified an assembly binding for a newer version of an assembly used in my app, and works great.

However, on one of my client machines, the new version of that assembly is missing, but instead the old one is present. When I try to run the app, it says it cannot find the new version, which is normal, I guess. The question is, how can I tell the .NET framework to use back the old version if the ne开发者_Go百科w version is not available?

The purpose is to have a unique config file that works automatically depending of the assembly version installed on any client machine. I want to have a unique configuration file, that works like this:

  • if referenced assembly has version 1, than use that version 1.
  • if referenced assembly has version 2, than use that version 2.
  • ... etc

I'm trying to avoid to modify the assemblyBinding information at runtime, depending of the installed version of that referenced assembly.

Any ideas? Thanks.


You'd have to load the assembly at runtime using Assembly.Load or something along those lines. The .NET assembly redirection doesn't have support for if statements and fallbacks and things like that.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜