The Problem
My builds keep failing due to"
C:\Program Files (x86)\MSBuild\14.0\bin\amd64\Microsoft.Common.CurrentVersion.targets (1820): Could not resolve this reference. Could not locate the assembly "Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
I have spent a bunch of time trying to bug swat this and I have come up blank. Any kind of help would be highly appreciated!
When I RDP into my build server and browse the packages folder of the build, NewtonSoft.Json is not there. For some reason it is not being downloaded, however, when I build it on my local computer it downloads it just fine.
What I have tried:
- I have checked that no packages folder exists in source control
- I have upgraded nuget.exe to the latest version (4.3.0) and then downgraded back down to 3.4.4 (this upgrade broke everything)
- I have deleted the builds folder on the build server
- I have inspected my web config file which has this:
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
- I have inspected my .csproj file which has this:
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
- I have checked my NuGet.Config file which has this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<packageSources>
<add key="NuGet.Org Ver 3" value="https://api.nuget.org/v3/index.json" />
<add key="NuGet official package source" value="https://nuget.org/api/v2/" />
</packageSources>
<disabledPackageSources />
</configuration>
- I have checked my packages.config file which has this:
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net452" />
I am running Visual Studio 2015 Update 3
Build server is TFS 2013
Solved (but I shouldn't have to do this, something is very wrong) I solved it by simply downgrading NewtonSoft.Json to 9.0.1