- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
给定以下代码:
var n1 = new AssemblyName ("TestDll, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089");
var n2 = new AssemblyName ("TestDll, Version=2.0.0.2001, Culture=en-US, PublicKeyToken=ab7a5c561934e089");
Console.WriteLine (AssemblyName.ReferenceMatchesDefinition (n1, n2));
Console.WriteLine (AssemblyName.ReferenceMatchesDefinition (n2, n1));
为什么这两个检查都打印“True”?我原以为 AssemblyName.ReferenceMatchesDefinition 应该考虑程序集名称的版本、文化和公钥 token 属性的差异,不是吗?
如果不是,那么 ReferenceMatchesDefinition 做了哪些简单名称的比较没有做的事情?
最佳答案
我已经在 Microsoft Connect 上报告了这个问题, 并已确认为错误:
This is indeed a bug in the API. It has been in the product since it was introduced in 2.0 RTM. It never worked properly.
[...]
You may also consider API AppDomain.ApplyPolicy (with manual AssemblyName comparison). The API covers Framework assembly unification and binding redirects.You might also try to cover non-strong name assembly references. When PublicKeyToken is not present in the reference, only simple name match happens, the rest is ignored.
关于c# - AssemblyName.ReferenceMatchesDefinition 如何工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2494421/
给定以下代码: var n1 = new AssemblyName ("TestDll, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=b77a
我是一名优秀的程序员,十分优秀!