Nuget Update-Package 错误地更新程序集绑定重定向 [英] Nuget Update-Package incorrectly updating assembly binding redirects
问题描述
我有一个包含单个 dll 的内部 NuGet 包,没有外部 NuGet 包依赖项,也没有 web.config 转换.
然而,当我针对这个特定的 NuGet 在我的项目(类库和网站)上运行 Update-Package 时,它会自动更新我的网站 web.config 程序集绑定重定向到 旧 版本的 System.Web.Mvc 和 Newtonsoft.Json.网站 web.config 目前已将它们绑定到正在使用的最新版本.
使用 GUI,利用管理解决方案的 NuGet 包...我选择更新此 NuGet 以用于引用旧版本的适用项目.然后选择更新
这是包管理器的输出:
跳过应用绑定重定向现在是 NuGet 3.3.0 中的一个选项:
I have an internal NuGet package that contains a single dll, no external NuGet package dependencies, and no web.config transforms.
Yet when i run Update-Package on my projects (class lib and website) for this specific NuGet, it automatically is updating my website web.config assembly binding redirects to older versions of System.Web.Mvc and Newtonsoft.Json. The website web.config currently has them bound to the latest version being used.
Using the GUI, utilizing Manage NuGet packages for Solution... I choose to UPDATE this NuGet for applicable projects that have a reference to the old version. Then choose Update
Here is the output from Package Manager: http://pastebin.com/3ySwTRFR
And my web.config went from:
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-5.1.0.0" newVersion="5.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
To:
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0" />
</dependentAssembly>
The NuGet package I am updating has a dll which references Newtonsoft.Json (but is not explicitly made a NuGet package dependency)
When unknowing developer updates this NuGet package it breaks the runtime looking for old version of MVC or JSON.NET dlls.
In the past I have attempted to use the -IgnoreDependencies powershell command switch, but this appears to have no impact on the issue.
Any idea on what could be transforming my web.configs (without an explicit transform) during update-package?
Edit: VS2015 w/ NuGet 3.3.0 seems to be behaving better... during random package update it found an old BAD binding redirect and corrected it!
Skip applying binding redirects is an option now in NuGet 3.3.0: Issue #1147
这篇关于Nuget Update-Package 错误地更新程序集绑定重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!