简体   繁体   中英

Why does the Newtonsoft.json 12.0.2 nuget package fails to restore using Nuget Restore task in TFS 2017 Update3?

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>

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM