Azure Pipelines 在 NuGet 恢复阶段失败
Azure Pipelines failing at NuGet Restore stage
我正在使用图像 vs2017-win2016 进行构建,作为构建的一部分,我有 Nuget 还原任务失败并显示以下错误消息。有人可以告诉我这里出了什么问题以及我们如何解决它吗?这是一个简单的 Asp.Net 网络应用程序。
2021-06-25T09:01:16.6036745Z ##[section]Starting: NuGet restore
2021-06-25T09:01:16.6136450Z ==============================================================================
2021-06-25T09:01:16.6136733Z Task : NuGet
2021-06-25T09:01:16.6137224Z Description : Restore, pack, or push NuGet packages, or run a NuGet command. Supports NuGet.org and authenticated feeds like Azure Artifacts and MyGet. Uses NuGet.exe and works with .NET Framework apps. For .NET Core and .NET Standard apps, use the .NET Core task.
2021-06-25T09:01:16.6137701Z Version : 2.179.0
2021-06-25T09:01:16.6138100Z Author : Microsoft Corporation
2021-06-25T09:01:16.6138522Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/package/nuget
2021-06-25T09:01:16.6138831Z ==============================================================================
2021-06-25T09:01:17.3136968Z SYSTEMVSSCONNECTION exists true
2021-06-25T09:01:17.4377830Z SYSTEMVSSCONNECTION exists true
2021-06-25T09:01:17.8046121Z [command]C:\Windows\system32\chcp.com 65001
2021-06-25T09:01:17.8104107Z Active code page: 65001
2021-06-25T09:01:17.8631847Z Detected NuGet version 4.4.1.4656 / 4.4.1
2021-06-25T09:01:17.8642220Z SYSTEMVSSCONNECTION exists true
2021-06-25T09:01:17.8812714Z [command]C:\hostedtoolcache\windows\NuGet.4.1\x64\nuget.exe sources Add -NonInteractive -Name NuGetOrg -Source https://api.nuget.org/v3/index.json -ConfigFile D:\a\Nuget\tempNuGet_31.config
2021-06-25T09:01:19.1590360Z Package Source with Name: NuGetOrg added successfully.
2021-06-25T09:01:19.1660433Z [command]C:\hostedtoolcache\windows\NuGet.4.1\x64\nuget.exe restore D:\a\s\VSDemoPipeline.sln -Verbosity Detailed -NonInteractive -ConfigFile D:\a\Nuget\tempNuGet_31.config
2021-06-25T09:01:47.4269841Z C:\Program Files\dotnet\sdk.1.524\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.1. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.1. [D:\a\s\VSDemoPipeline\VSDemoPipeline.csproj]
2021-06-25T09:01:47.4271151Z
2021-06-25T09:01:47.4279527Z NuGet Version: 4.4.1.4656
2021-06-25T09:01:47.4280682Z MSBuild auto-detection: using msbuild version '15.9.21.664' from 'C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\MSBuild.0\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
2021-06-25T09:01:47.4281803Z MSBuild P2P timeout [ms]: 120000
2021-06-25T09:01:47.4283437Z C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\MSBuild.0\bin\msbuild.exe "C:\Users\VssAdministrator\AppData\Local\Temp\NuGetScratchrucjvrx.krk.nugetinputs.targets" /t:GenerateRestoreGraphFile /nologo /nr:false /v:q /p:NuGetRestoreTargets="C:\Users\VssAdministrator\AppData\Local\Temp\NuGetScratch\opqnszhe.dir.nugetrestore.targets" /p:RestoreTaskAssemblyFile="C:\hostedtoolcache\windows\NuGet.4.1\x64\nuget.exe" /p:RestoreSolutionDirectory="D:\a\s" /p:RestoreConfigFile="D:\a\Nuget\tempNuGet_31.config" /p:SolutionDir="D:\a\s"
2021-06-25T09:01:47.4289820Z NuGet.CommandLine.ExitCodeException: Exception of type 'NuGet.CommandLine.ExitCodeException' was thrown.
2021-06-25T09:01:47.4334578Z at NuGet.CommandLine.MsBuildUtility.<GetProjectReferencesAsync>d__6.MoveNext()
2021-06-25T09:01:47.4335343Z --- End of stack trace from previous location where exception was thrown ---
2021-06-25T09:01:47.4335807Z at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2021-06-25T09:01:47.4336289Z at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2021-06-25T09:01:47.4336788Z at NuGet.CommandLine.RestoreCommand.<GetDependencyGraphSpecAsync>d__48.MoveNext()
2021-06-25T09:01:47.4337172Z --- End of stack trace from previous location where exception was thrown ---
2021-06-25T09:01:47.4337555Z at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2021-06-25T09:01:47.4337950Z at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2021-06-25T09:01:47.4339708Z at NuGet.CommandLine.RestoreCommand.<DetermineInputsFromMSBuildAsync>d__43.MoveNext()
2021-06-25T09:01:47.4855912Z ##[error]The nuget command failed with exit code(1) and error(C:\Program Files\dotnet\sdk.1.524\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.1. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.1. [D:\a\s\VSDemoPipeline\VSDemoPipeline.csproj])
2021-06-25T09:01:47.4866755Z ##[error]Packages failed to restore
2021-06-25T09:01:47.4877131Z ##[section]Finishing: NuGet restore
要在 NET Core 3.1 或更高版本上构建 APS.NET 应用程序,请在 Azure DevOps 中使用 windows-latest
代理。
旧版本的代理不支持它,如果您注意到,从错误中也可以看出这一点。
The nuget command failed with exit code(1) and error(C:\Program Files\dotnet\sdk.1.524\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.1. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.1. [D:\a\s\VSDemoPipeline\VSDemoPipeline.csproj])
2021-06-25T09:01:47.4866755Z ##[error]Packages failed to restore
在管道中确保您有适当版本的“使用 Dotnet Core”任务:
我正在使用图像 vs2017-win2016 进行构建,作为构建的一部分,我有 Nuget 还原任务失败并显示以下错误消息。有人可以告诉我这里出了什么问题以及我们如何解决它吗?这是一个简单的 Asp.Net 网络应用程序。
2021-06-25T09:01:16.6036745Z ##[section]Starting: NuGet restore
2021-06-25T09:01:16.6136450Z ==============================================================================
2021-06-25T09:01:16.6136733Z Task : NuGet
2021-06-25T09:01:16.6137224Z Description : Restore, pack, or push NuGet packages, or run a NuGet command. Supports NuGet.org and authenticated feeds like Azure Artifacts and MyGet. Uses NuGet.exe and works with .NET Framework apps. For .NET Core and .NET Standard apps, use the .NET Core task.
2021-06-25T09:01:16.6137701Z Version : 2.179.0
2021-06-25T09:01:16.6138100Z Author : Microsoft Corporation
2021-06-25T09:01:16.6138522Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/package/nuget
2021-06-25T09:01:16.6138831Z ==============================================================================
2021-06-25T09:01:17.3136968Z SYSTEMVSSCONNECTION exists true
2021-06-25T09:01:17.4377830Z SYSTEMVSSCONNECTION exists true
2021-06-25T09:01:17.8046121Z [command]C:\Windows\system32\chcp.com 65001
2021-06-25T09:01:17.8104107Z Active code page: 65001
2021-06-25T09:01:17.8631847Z Detected NuGet version 4.4.1.4656 / 4.4.1
2021-06-25T09:01:17.8642220Z SYSTEMVSSCONNECTION exists true
2021-06-25T09:01:17.8812714Z [command]C:\hostedtoolcache\windows\NuGet.4.1\x64\nuget.exe sources Add -NonInteractive -Name NuGetOrg -Source https://api.nuget.org/v3/index.json -ConfigFile D:\a\Nuget\tempNuGet_31.config
2021-06-25T09:01:19.1590360Z Package Source with Name: NuGetOrg added successfully.
2021-06-25T09:01:19.1660433Z [command]C:\hostedtoolcache\windows\NuGet.4.1\x64\nuget.exe restore D:\a\s\VSDemoPipeline.sln -Verbosity Detailed -NonInteractive -ConfigFile D:\a\Nuget\tempNuGet_31.config
2021-06-25T09:01:47.4269841Z C:\Program Files\dotnet\sdk.1.524\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.1. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.1. [D:\a\s\VSDemoPipeline\VSDemoPipeline.csproj]
2021-06-25T09:01:47.4271151Z
2021-06-25T09:01:47.4279527Z NuGet Version: 4.4.1.4656
2021-06-25T09:01:47.4280682Z MSBuild auto-detection: using msbuild version '15.9.21.664' from 'C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\MSBuild.0\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
2021-06-25T09:01:47.4281803Z MSBuild P2P timeout [ms]: 120000
2021-06-25T09:01:47.4283437Z C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\MSBuild.0\bin\msbuild.exe "C:\Users\VssAdministrator\AppData\Local\Temp\NuGetScratchrucjvrx.krk.nugetinputs.targets" /t:GenerateRestoreGraphFile /nologo /nr:false /v:q /p:NuGetRestoreTargets="C:\Users\VssAdministrator\AppData\Local\Temp\NuGetScratch\opqnszhe.dir.nugetrestore.targets" /p:RestoreTaskAssemblyFile="C:\hostedtoolcache\windows\NuGet.4.1\x64\nuget.exe" /p:RestoreSolutionDirectory="D:\a\s" /p:RestoreConfigFile="D:\a\Nuget\tempNuGet_31.config" /p:SolutionDir="D:\a\s"
2021-06-25T09:01:47.4289820Z NuGet.CommandLine.ExitCodeException: Exception of type 'NuGet.CommandLine.ExitCodeException' was thrown.
2021-06-25T09:01:47.4334578Z at NuGet.CommandLine.MsBuildUtility.<GetProjectReferencesAsync>d__6.MoveNext()
2021-06-25T09:01:47.4335343Z --- End of stack trace from previous location where exception was thrown ---
2021-06-25T09:01:47.4335807Z at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2021-06-25T09:01:47.4336289Z at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2021-06-25T09:01:47.4336788Z at NuGet.CommandLine.RestoreCommand.<GetDependencyGraphSpecAsync>d__48.MoveNext()
2021-06-25T09:01:47.4337172Z --- End of stack trace from previous location where exception was thrown ---
2021-06-25T09:01:47.4337555Z at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2021-06-25T09:01:47.4337950Z at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2021-06-25T09:01:47.4339708Z at NuGet.CommandLine.RestoreCommand.<DetermineInputsFromMSBuildAsync>d__43.MoveNext()
2021-06-25T09:01:47.4855912Z ##[error]The nuget command failed with exit code(1) and error(C:\Program Files\dotnet\sdk.1.524\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.1. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.1. [D:\a\s\VSDemoPipeline\VSDemoPipeline.csproj])
2021-06-25T09:01:47.4866755Z ##[error]Packages failed to restore
2021-06-25T09:01:47.4877131Z ##[section]Finishing: NuGet restore
要在 NET Core 3.1 或更高版本上构建 APS.NET 应用程序,请在 Azure DevOps 中使用 windows-latest
代理。
旧版本的代理不支持它,如果您注意到,从错误中也可以看出这一点。
The nuget command failed with exit code(1) and error(C:\Program Files\dotnet\sdk.1.524\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.1. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.1. [D:\a\s\VSDemoPipeline\VSDemoPipeline.csproj]) 2021-06-25T09:01:47.4866755Z ##[error]Packages failed to restore
在管道中确保您有适当版本的“使用 Dotnet Core”任务: