fel*_*ckz 13 asp.net-mvc json.net nuget assembly-binding-redirect visual-studio-2013
我有一个内部NuGet包,其中包含一个dll,没有外部NuGet包依赖项,也没有web.config转换.
然而,当我在我的项目(类lib和网站)上为这个特定的NuGet运行Update-Package时,它会自动更新我的网站web.config程序集绑定重定向到旧版本的System.Web.Mvc和Newtonsoft.Json.web.config网站目前已将它们绑定到正在使用的最新版本.
使用GUI,利用管理NuGet包进行解决方案...我选择为具有旧版本引用的适用项目更新此NuGet.然后选择更新
以下是Package Manager的输出: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>
Run Code Online (Sandbox Code Playgroud)
至:
<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>
Run Code Online (Sandbox Code Playgroud)
我正在更新的NuGet包有一个引用Newtonsoft.Json的dll(但是没有明确地使用NuGet包依赖)
当不知情的开发人员更新这个NuGet包时,它会破坏运行时寻找旧版本的MVC或JSON.NET dll.
在过去,我尝试使用-IgnoreDependencies powershell命令开关,但这似乎对该问题没有影响.
在update-package期间有什么可以改变我的web.configs(没有显式转换)的想法?
编辑:VS2015与NuGet 3.3.0似乎表现得更好...在随机软件包更新期间,它发现了一个旧的BAD绑定重定向并更正了它! 
blu*_*hal 10
在包管理器控制台中使用以下命令
PM> Get-Project –All | 添加绑定重定向
有关详细说明,请参阅https://weblog.west-wind.com/posts/2014/nov/29/updating-assembly-redirects-with-nuget。
| 归档时间: |
|
| 查看次数: |
3700 次 |
| 最近记录: |