【问题标题】:Nuget restore fails in vsts在 vsts 中 Nuget 还原失败
【发布时间】:2018-03-12 13:43:35
【问题描述】:

我的解决方案在 VS2017 和 VisualStudioVersion = 14.0.25420 中编译

在 vsts 构建定义中 Nuget 还原失败。已执行以下步骤:

我参考了以下链接并尝试执行它们,但仍然抛出相同的错误:

Using the latest NuGet in your build

仍然没有运气。

详细日志:

2018-03-16T08:30:20.9863624Z 任务:NuGet 2018-03-16T08:30:20.9863815Z 描述:还原、打包或推送 NuGet 包,或运行 NuGet 命令。支持 NuGet.org 和经过身份验证的源,如包管理和 MyGet。使用 NuGet.exe 并与 .NET Framework 应用程序一起使用。对于 .NET Core 和 .NET Standard 应用,请使用 .NET Core 任务。 2018-03-16T08:30:20.9863996Z 版本:2.0.24 2018-03-16T08:30:20.9864098Z 作者:微软公司 2018-03-16T08:30:20.9864232Z 帮助:More Information 2018-03-16T08:30:20.9864356Z ======================================== ======================================= 2018-03-16T08:30:23.3611981Z 缓存工具:NuGet 4.1.0 x64

2018-03-16T08:30:23.3717038Z 在缓存中找到工具:NuGet 4.1.0 x64

2018-03-16T08:30:23.3790881Z 从工具缓存中解析:4.1.0

2018-03-16T08:30:23.3791208Z 使用版本:4.1.0

2018-03-16T08:30:23.3794629Z 在缓存中找到工具:NuGet 4.1.0 x64

2018-03-16T08:30:23.4907509Z [命令]C:\Windows\system32\chcp.com 65001

2018-03-16T08:30:23.5489365Z 活动代码页:65001

2018-03-16T08:30:23.5831075Z 检测到 NuGet 版本 4.1.0.2450 / 4.1.0

2018-03-16T08:30:23.5953230Z SYSTEMVSSCONNECTION 存在 true

2018-03-16T08:30:23.5976398Z 将 NuGet.config 保存到临时配置文件。

2018-03-16T08:30:23.6021481Z [command]D:\a_tool\NuGet\4.1.0\x64\nuget.exe 源添加 -NonInteractive -Name NuGetOrg -Source https://api.nuget.org/v3/index.json -ConfigFile D:\a \1\Nuget\tempNuGet_13.config

2018-03-16T08:30:26.0565743Z 已成功添加名称为 NuGetOrg 的包源。

2018-03-16T08:30:26.0571052Z 将 NuGet.config 保存到临时配置文件。

2018-03-16T08:30:26.0704297Z [命令]D:\a_tool\NuGet\4.1.0\x64\nuget.exe 恢复 D:\a\ts.sln -详细信息 -NonInteractive -ConfigFile D: \a\1\Nuget\tempNuGet_13.config

2018-03-16T08:30:29.9861727Z NuGet 版本:4.1.0.2450

2018-03-16T08:30:29.9862227Z MSBuild 自动检测:使用来自 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin 的 msbuild 版本 '15.6.82.30579' '。使用选项 -MSBuildVersion 强制 nuget 使用特定版本的 MSBuild。

2018-03-16T08:30:29.9863068Z System.AggregateException:发生一个或多个错误。 ---> NuGet.CommandLine.CommandLineException:解析 D:\a\ts.sln 处的解决方案文件时出错:调用目标已引发异常。

2018-03-16T08:30:29.9868970Z 在 NuGet.CommandLine.MsBuildUtility.GetAllProjectFileNamesWithMsBuild(String solutionFile, String msbuildPath)

2018-03-16T08:30:29.9869367Z 在 NuGet.CommandLine.RestoreCommand.ProcessSolutionFile(String solutionFileFullPath, PackageRestoreInputs restoreInputs)

2018-03-16T08:30:29.9869611Z 在 NuGet.CommandLine.RestoreCommand.d__37.MoveNext()

2018-03-16T08:30:29.9869813Z --- 从先前抛出异常的位置结束堆栈跟踪---

2018-03-16T08:30:29.9869995Z 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

2018-03-16T08:30:29.9870166Z 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

2018-03-16T08:30:29.9870995Z 在 NuGet.CommandLine.RestoreCommand.d__30.MoveNext()

2018-03-16T08:30:29.9871164Z --- 内部异常堆栈跟踪结束 ---

2018-03-16T08:30:30.0446275Z ##[错误] nuget 命令失败,退出代码 (1) 和错误(System.AggregateException: 发生一个或多个错误。---> NuGet.CommandLine.CommandLineException :解析 D:\a\ts.sln 处的解决方案文件时出错:调用目标已引发异常。 在 NuGet.CommandLine.MsBuildUtility.GetAllProjectFileNamesWithMsBuild(字符串解决方案文件,字符串 msbuildPath) 在 NuGet.CommandLine.RestoreCommand.ProcessSolutionFile(字符串 solutionFileFullPath,PackageRestoreInputs restoreInputs) 在 NuGet.CommandLine.RestoreCommand.d__37.MoveNext() --- 从先前抛出异常的位置结束堆栈跟踪 --- 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) 在 NuGet.CommandLine.RestoreCommand.d__30.MoveNext() --- 内部异常堆栈跟踪结束 --- 在 System.Threading.Tasks.Task.ThrowIfExceptional(布尔 includeTaskCanceledExceptions) 在 System.Threading.Tasks.Task.Wait(Int32 毫秒超时,CancellationToken 取消令牌) 在 NuGet.CommandLine.Command.Execute() 在 NuGet.CommandLine.Program.MainCore(字符串工作目录,字符串 [] 参数) --->(内部异常 #0)NuGet.CommandLine.CommandLineException:解析 D:\a\ts.sln 处的解决方案文件时出错:调用目标已引发异常。 在 NuGet.CommandLine.MsBuildUtility.GetAllProjectFileNamesWithMsBuild(字符串解决方案文件,字符串 msbuildPath) 在 NuGet.CommandLine.RestoreCommand.ProcessSolutionFile(字符串 solutionFileFullPath,PackageRestoreInputs restoreInputs) 在 NuGet.CommandLine.RestoreCommand.d__37.MoveNext() --- 从先前抛出异常的位置结束堆栈跟踪 --- 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) 在 NuGet.CommandLine.RestoreCommand.d__30.MoveNext()

2018-03-16T08:30:30.0459326Z ##[错误]包无法恢复

2018-03-16T08:30:30.0477190Z ##[section]完成:NuGet 恢复

【问题讨论】:

  • 配置看起来不错,看起来你的 sln 文件有些奇怪。错误消息在最后一个屏幕截图中被截断,但这看起来像这个问题 -> stackoverflow.com/questions/36777583/…
  • 看来您正在使用托管 VS2017 代理。如果您的项目是 VS2015 中的开发人员,请改用 Hosted agent,并改用 nuget 3.5。或者您可以在一个驱动器中分享您的解决方案吗?
  • @Marina - 是的,我的一个项目是在 VS2015 中创建的,它在本地编译时没有错误。但是当我只使用带有“托管”代理的 nuget 恢复任务时。然后我收到错误消息“nuget 命令失败,退出代码(1)和错误(packages.config 项目中的错误包无法恢复”
  • 以上截图是在VS 2017开发的第二个项目。我使用代理作为“托管VS2017”和nuget任务版本“2”。
  • @Marina - 我的项目在本地编译成功。我添加到 VSTS 的同一个解决方案,只是创建了一个简单的 CI 定义(只有 Nuget 任务)

标签: azure-pipelines nuget-package-restore azure-pipelines-build-task


【解决方案1】:

帮助我的是https://github.com/NuGet/Home/issues/6918 中描述的问题和 AndrewGretton 描述的解决方法。

  1. 在构建代理上从https://www.microsoft.com/net/download/dotnet-framework-runtime 下载并安装 .NET 4.7.2 运行时(不是 SDK)
  2. 重启代理

【讨论】:

  • 这是我们的解决方案。不过,这让我们在一周内获得了两次。我希望他们尽快解决根本原因。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-05-02
  • 2017-03-07
  • 1970-01-01
  • 1970-01-01
  • 2018-09-12
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多