Visual Studio中保持与旧版本的覆盖NewtonSoft.Json.DLL [英] Visual Studio keeps overwriting NewtonSoft.Json.DLL with an older version

查看:1186
本文介绍了Visual Studio中保持与旧版本的覆盖NewtonSoft.Json.DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Studio是覆盖NewtonSoft.Json.DLL的正确版本,我在我的项目引用,并当我建立除了包含参考网站的所有其他项目的旧版本的NuGet包文件都已经配置。

Visual Studio is overwriting the correct version of NewtonSoft.Json.DLL that I have configured in both my project references and the NuGet package file with an older version when I build any other project besides the website that contains the reference.

确定。下面是这种情况:

OK. Here is the scenario:

我有一个后端服务和网站的解决方案。该网站是在.NET 4.5运行,并与配置的NuGet在Newtonsoft.Json.DLL 6.0.1版本拉。

I have a solution with a backend service and a website. The website is running on .NET 4.5 and is configured with NuGet to pull in version 6.0.1 of Newtonsoft.Json.DLL.

<package id="Newtonsoft.Json" version="6.0.1" targetFramework="net45" />



它增加了dependenAssembly结合的web.config文件。

Which adds the dependenAssembly binding to the web.config file.

  <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>



我可以生成并运行此网站没有任何问题。

I can build and run this website without any problems.

我最近更新了所有的类库和后端服务从.NET 4.0到.NET 4.5。更新后,每当我建类库中的一个或运行/调试后端服务,该网站就无法工作。

I recently updated all of the class libraries and backend service from .NET 4.0 to .NET 4.5. After the update, whenever I build one of the class libraries or run/debug the backend service, the website becomes inoperable.

Could not load file or assembly 'Newtonsoft.Json' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)



我跟踪下来的事实重建类的一个时4.5.11版本 - 库或运行/调试从Visual Studio后端的服务,Newtonsoft.Json.DLL获取与该文件的旧版本覆盖。由于明确dependentAssembly结合,任何时候,我访问该网站后,我得到上面提到的无法加载...'错误。

I tracked this down to the fact that when rebuilding one of the class libraries or running/debugging the backend service from Visual Studio, the Newtonsoft.Json.DLL gets overwritten with an older version of the file - version 4.5.11. Because of the explicit dependentAssembly binding, any time I access the website after that I get the 'Could not load ...' error mentioned above.

这将是美好的,如果我只是想运行一个或其他后端服务或网站,但我必须跑他们两个在一起,让我的应用程序运行正常。但是,由于这个错误,我不能在同一时间,该网站或网站崩溃运行后端服务。

This would be OK if I just wanted to run one or the other of the backend service or the website, but I have to run them both together to get my application running properly. But because of this error I cannot have the backend service running at the same time as the website or the website crashes.

我如何防止覆盖DLL的Visual Studio?

How do I prevent Visual Studio from overwriting the DLL?

请注意,我有参考设置仅6.0.1整个解决方案(即没有参考的随时随地的到4.5.11) 。而在网站上我有复制本地设置为true,特定版本也被设置为true Newtonsoft.Json.DLL。

Note that I have the reference set for only 6.0.1 across the entire solution (i.e. there is no reference anywhere to 4.5.11). And in the website I have 'Copy Local' set to true and 'Specific Version' is also set to true for the Newtonsoft.Json.DLL.

推荐答案

这是一个的已知的bug 的Windows Azure工具VS

解决方法:


  • 删除从程序Files\Microsoft $ b $ Newtonsoft.Json.dll文件b SDKs\Windows Azure.NET SDK\v2.3\ref\\ \\文件夹中。

  • Remove Newtonsoft.Json.dll file from Program Files\Microsoft SDKs\Windows Azure.NET SDK\v2.3\ref\ folder.

卸载的Windows Azure工具VS v 2.3

Uninstall Windows Azure VS Tools v 2.3

这篇关于Visual Studio中保持与旧版本的覆盖NewtonSoft.Json.DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆