说我们有:
Nuget具有强大的功能,可自动检测这些程序集冲突并创建绑定重定向指令。 Nuget命令 Add-BindingRedirect 将这些字符串添加到测试项目web.config文件中:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="NH" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
现在想象我们有更多的库,引用NH。 问题是:识别奇数版本的最佳(最好不是手动)方式是什么?
答案 0 :(得分:1)
要调查绑定错误,您可以使用Fusion Log Viewer。
您可以将其配置为记录所有绑定,这将基本上让您深入了解哪些程序集从哪里加载。
典型输出如下:
=== Pre-bind state information ===
LOG: DisplayName = graphicfailtest.resources, Version=0.0.0.0, Culture=en-US, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = C:\bla\graphic\cs\
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : graphicfailtest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: Processing DEVPATH.
LOG: DEVPATH is not set. Falling through to regular bind.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Post-policy reference: graphicfailtest.resources, Version=0.0.0.0, Culture=en-US, PublicKeyToken=null
LOG: Attempting download of new URL file:///C:..../graphicfailtest.resources.DLL.
LOG: All probing URLs attempted and failed.