0

I got some strange issue here, have a software that build normally in Visual Studio, all references where added using NuGet, and the Newtonsoft.Json.dll is in the packages folder and also the reference points to that folder.

When building in the build server, we notice test failures and going further we found that the Newtonsoft.Json.dll copyed in fact was the wrong one, from Blend folder.

From build log:

Copying file from "D:\APPS\Microsoft Visual Studio 12.0\Blend\Newtonsoft.Json.dll" to "D:\TB\2\PLWRO-WebPP\WebPP-Main-Dev-CI\bin\Newtonsoft.Json.dll".

To solve it I renamed Newtonsoft.Json.dll from blend folder for another thing, and then the build got to work normally as expected.

My question is, WHYYY?!?!? Seems that the build is looking for references before in the Blend folder and not in the set location in the hint path - see below.

<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
Fabito
  • 1,165
  • 2
  • 13
  • 30

1 Answers1

0

You could try adding the <private>true</private> element after your HintPath element. This should force the copy to the local directory.

The other part that is interesting, you are looking for an old version (v4.5.0.0) whilst referencing a new version (7.0.1) in your packages.

In Visual Studio, you could try asking Nuget to update the reference to 7.x for this library, and then see if that helps MSBuild pull the library from a more specific location.

Adam Stewart
  • 1,983
  • 1
  • 18
  • 25
  • Actually v4.5.0.0 refers to the correct package, if you try to add the package you will see that version in the "Include" as well. Why "private" as "true" should work? And why this should be different only for this package? – Fabito Oct 19 '15 at 10:59