【发布时间】:2019-03-27 19:13:23
【问题描述】:
我有一个包含单个 dll 的内部 NuGet 包,没有外部 NuGet 包依赖项,也没有 web.config 转换。
然而,当我在我的项目(类库和网站)上为此特定 NuGet 运行 Update-Package 时,它会自动更新我的网站 web.config 程序集绑定重定向到 旧 版本的 System.Web .Mvc 和 Newtonsoft.Json。网站 web.config 当前将它们绑定到正在使用的最新版本。
使用 GUI,利用管理 NuGet 包进行解决方案...我选择为引用旧版本的适用项目更新此 NuGet。然后选择更新
这是包管理器的输出:http://pastebin.com/3ySwTRFR
我的 web.config 来自:
<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>
收件人:
<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>
我正在更新的 NuGet 包有一个引用 Newtonsoft.Json 的 dll(但没有明确地成为 NuGet 包依赖项)
当不知情的开发人员更新此 NuGet 包时,它会中断运行时以查找旧版本的 MVC 或 JSON.NET dll。
过去我曾尝试使用-IgnoreDependencies powershell command switch,但这似乎对问题没有影响。
关于在更新包期间什么可以转换我的 web.configs(没有显式转换)的任何想法?
编辑:带有 NuGet 3.3.0 的 VS2015 似乎表现更好......在随机包更新期间,它发现了一个旧的 BAD 绑定重定向并更正了它!
【问题讨论】:
标签: asp.net-mvc visual-studio-2013 json.net nuget assembly-binding-redirect