管道在“ nuget软件包”还原时失败

时间:2020-03-15 16:15:30

标签: asp.net-core azure-devops azure-pipelines devops

我创建了一个管道,但是当该过程始终在“ Nuget Restore”上失败时,请参见下面的错误消息。

我不明白为什么

感谢您的帮助

enter image description here

*The nuget command failed with exit code(1) and error(C:\Program Files\dotnet\sdk\2.2.110\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.0. Either target .NET Core 2.2 or lower, or use a version of the .NET SDK that supports .NET Core 3.0. [D:\a\1\s\PackSecurity\PackSecurity.csproj] C:\Program Files\dotnet\sdk\2.2.110\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.0. Either target .NET Core 2.2 or lower, or use a version of the .NET SDK that supports .NET Core 3.0. [D:\a\1\s\PackSecurity.Tests\PackSecurity.Tests.csproj])
Packages failed to restore*

2 个答案:

答案 0 :(得分:2)

使用“ windows-2019”作为代理。单击“代理作业1”,并将“代理规范”设置为“ windows-2019”。

让我知道它是否对您有用。

Agent specification -> windows-2019

答案 1 :(得分:1)

根据错误消息:

当前的.NET SDK不支持定位.NET Core 3.0。要么 目标.NET Core 2.2或更低版本,或使用的.NET SDK版本 支持.NET Core 3.0。

我们可以知道您有一个或多个针对.NET Core 3.0的项目,但是默认情况下,您选择的代理没有安装该版本的.NET Core。它应该安装了版本2.2.11

要解决此问题,我们可以添加使用.NET Core task来安装.net core 3.0.x

enter image description here

检查similar ticket以获得更多详细信息。

希望这会有所帮助。