【问题标题】:Why does the Newtonsoft.json 12.0.2 nuget package fails to restore using Nuget Restore task in TFS 2017 Update3?为什么 Newtonsoft.json 12.0.2 nuget 包无法使用 TFS 2017 Update3 中的 Nuget 还原任务进行还原?
【发布时间】:2019-07-18 15:48:17
【问题描述】:

我在 TFS 2017 中创建了一个构建定义,这个构建定义中配置了一个 nuget 恢复任务,它尝试从我们的私有 nuget 存储库下载 newtonsoft.json 12.0.2 包,但无法恢复newtonsoft nuget 包,并且仅恢复 package.config 中也提到的其他 nuget 包。

我已经复制了 nuget restore 任务的日志以供参考。

==============================================================================
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 文件 -

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

【问题讨论】:

  • 提要中存在版本 12.0.2?
  • 是的,它确实存在,甚至在我使用 Visual Studio 手动构建解决方案时被下载。
  • @SRP,您确定成功下载的包来自您的提要,而来自nuget.org/packages?下载包时可以使用Fiddler工具跟踪http请求。
  • @Lu Mike,是的,VS 正在从我们的私人提要中下载它,因为我没有选中其他 nuget 提要,即使 TFS 版本也在此路径“C:\Users\ 下载 .nupkg 文件” TFS_service\AppData\Local\NuGet\Cache" 文件夹,但无法在包文件夹中下载它,所有其他 nuget 正在下载并复制到包文件夹中。
  • @SRP,这个问题还发生吗?如果是这样,您能否尝试使用本地机器使用私有代理运行此构建?

标签: azure-devops json.net azure-pipelines-build-task nuget-package-restore


【解决方案1】:

问题已解决,我在构建任务中使用的是 nuget.exe 版本 3.3.0,我认为它与 Newtonsoft.json 12.0.2 不兼容。 当我在我的 nuget 还原任务中选择 Nuget.exe 版本 3.5.0 时,它开始从我们的提要下载 Newtonsoft.json 12.0.2 nuget 包。 另请注意,nuget 3.5.0 需要 MSBuild 14.0 才能执行。

谢谢。

【讨论】:

    猜你喜欢
    • 2023-03-04
    • 2017-12-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多