1
votes

I have a build definition created in TFS 2017 and this build definition has a nuget restore task configured in it, which tries to download the newtonsoft.json 12.0.2 package from a private nuget respository of us but it fails to restore the newtonsoft nuget package and only restores the other nuget packages that are also mentioned in the package.config.

I have copied the log as well of the nuget restore task for reference.

==============================================================================
Task         : NuGet Installer
Description  : Installs or restores missing NuGet packages
Version      : 0.2.31
Author       : Microsoft Corporation
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613747)
==============================================================================

C:\Windows\system32\chcp.com 65001
Active code page: 65001
Detected NuGet version 3.3.0.212 / 3.3.0
SYSTEMVSSCONNECTION exists true

C:\PoC\_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b\0.2.31\node_modules\nuget-task-common\NuGet\3.3.0\NuGet.exe restore -NonInteractive C:\PoC\1\s\Rec\Main-Rec\Web\MatchWebApp\MatchWebSolution.sln -NoCache
MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'.
Feeds used:
  http://vwmazpronuget:81/nuget/Common

Restoring NuGet package Microsoft.Web.Infrastructure.1.0.0.
Restoring NuGet package ePI.STeP.Message.load.Rec.1.0.0.
Adding package 'Microsoft.Web.Infrastructure.1.0.0' to folder 'C:\PoC\1\s\Rec\Main-Rec\Web\MatchWebApp\packages'
Adding package 'ePI.STeP.Message.load.Rec.1.0.0. to folder 'C:\PoC\1\s\Rec\Main-Rec\Web\MatchWebApp\packages'
Added package 'Microsoft.Web.Infrastructure.1.0.0' to folder 'C:\PoC\1\s\Rec\Main-Rec\Web\MatchWebApp\packages'
Added package 'ePI.STeP.Message.load.Rec.1.0.0' to folder 'C:\PoC\1\s\Rec\Main-Rec\Web\MatchWebApp\packages'
Restoring NuGet package Match.Common.Rec.1.0.0.
Restoring NuGet package Match.Payload.PI.1.0.0.
Restoring NuGet package MATCH.Rec.ThirdPartyComponents.1.0.0.
Adding package 'Match.Payload.PI.1.0.0' to folder 'C:\PoC\1\s\Rec\Main-Rec\Web\MatchWebApp\packages'
Added package 'Match.Payload.PI.1.0.0' to folder 'C:\PoC\1\s\Rec\Main-Rec\Web\MatchWebApp\packages'
Adding package 'Match.Common.Rec.1.0.0' to folder 'C:\PoC\1\s\Rec\Main-Rec\Web\MatchWebApp\packages'
Restoring NuGet package Newtonsoft.Json.12.0.2.
Added package 'Match.Common.Rec.1.0.0' to folder 'C:\PoC\1\s\Rec\Main-Rec\Web\MatchWebApp\packages'
WARNING: Unable to find version '12.0.2' of package 'Newtonsoft.Json'.
Adding package 'MATCH.Rec.ThirdPartyComponents.1.0.0' to folder 'C:\PoC\1\s\Rec\Main-Rec\Web\MatchWebApp\packages'
Added package 'MATCH.Rec.ThirdPartyComponents.1.0.0' to folder 'C:\PoC\1\s\Rec\Main-Rec\Web\MatchWebApp\packages'
Unable to find version '12.0.2' of package 'Newtonsoft.Json'.

Error: C:\PoC\_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b\0.2.31\node_modules\nuget-task-common\NuGet\3.3.0\NuGet.exe failed with return code: 1

Packages failed to install

******************************************************************************

Finishing: NuGet restore $(build.sourcesdirectory)/Rec\Main-Rec\Web\MatchWebApp\MatchWebSolution.sln

Package.config file -

<?xml version="1.0" encoding="utf-8"?>
<packages>
    <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net40" />
    <package id="ePI.STeP.Message.load.Rec" version="1.0.0" />
    <package id="Match.Common.Rec" version="1.0.0" />
    <package id="Match.Payload.PI" version="1.0.0" />
    <package id="MATCH.Rec.ThirdPartyComponents" version="1.0.0" />
     <package id="Newtonsoft.Json" version="12.0.2" targetFramework="net40" />
</packages>
1
The version 12.0.2 exist in the feed?Shayki Abramczyk
Yes, it does exist and even gets downloaded when i build the solution using the visual studio manually.SRP
@SRP, are you sure the package downloaded successfully is from your feed whereas from nuget.org/packages? You can use tool Fiddler to trace the http request when downloading the package.Lu Mike
@Lu Mike, Yes the VS is downloading it from our private feed because i have unchecked the other nuget feeds, even the TFS build is downloading the .nupkg file at this path "C:\Users\TFS_service\AppData\Local\NuGet\Cache" folder but fails to download it in the package folder where all other nuget are getting downloaded and copied in Package folder.SRP
@SRP, did this issue still happen? If so, could you please have a try to run this build with private agent using local machine?Lu Mike

1 Answers

1
votes

The issue has been resolved, I was using nuget.exe version 3.3.0 in my build task which I believe is not compatible for Newtonsoft.json 12.0.2. When I selected the Nuget.exe version 3.5.0 in my nuget restore task it started downloading the Newtonsoft.json 12.0.2 nuget package from our feed. Also note that nuget 3.5.0 needs MSBuild 14.0 to execute.

Thanks.