程序集版本匹配如何完全起作用? [英] How the assembly version matching works exactly?
本文介绍了程序集版本匹配如何完全起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我在GAC中具有版本为1.1.1.5、1.1.5.1、1.1.6.2、1.2.1.1和2.1.2.1的程序集.我的应用程序有一个1.1.3.0版本的参考.哪个程序集将在运行时匹配?以及装配匹配的实际规则是什么?
Let's say I have assemblies in GAC with versions, 1.1.1.5, 1.1.5.1, 1.1.6.2, 1.2.1.1 and 2.1.2.1. My application have a reference of 1.1.3.0 version. Which assembly will be matched at runtime? and what are the actual rules for assembly matching?
推荐答案
如果您的引用需要特定的版本,则默认情况下,它将在程序集加载时失败,因为该版本不存在.
If your reference requires a specific version, by default, it will fail on assembly load, as that version doesn't exist.
但是,可以通过组装绑定重定向对其进行配置.这里会发生多种变化,包括:
This can be configured, however, via Assembly Binding Redirection. There are various options of what will happen here, including:
- 该引用可以说它不关心版本控制,在这种情况下,将加载最新版本.
- 您可以配置应用程序,方法是指定如何重定向绑定.
- GAC中的程序集可以是使用发布者策略进行设置,用于指定如何处理这个.
- The reference can say that it doesn't care about versioning, in which case the newest is loaded.
- You can configure your application in a way that you specify how to redirect the binding.
- The assembly in the GAC can be setup with a publisher policy that specifies how to handle this.
这篇关于程序集版本匹配如何完全起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文