詹金斯没有拿起 nuget 恢复包

Jenkins not picking up the nuget restored packages

我在 Jenkins 中定义了以下步骤。

我可以看到 NuGet 正在恢复 Jenkins 控制台上的包,但是一旦 msbuild 开始构建,解决方案中的所有项目都会失败并出现以下错误。

错误:

"C:\Program Files\dotnet\sdk.1.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198,5): error NETSDK1064: Package Microsoft.EntityFrameworkCore.Analyzers, version 2.1.3 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions."

如果我从命令行使用 dotnet restore 命令恢复包并触发构建,那么它就会通过。所以从第一个构建步骤恢复包时出了点问题。我缺少什么?提前致谢!

我最终成功了。我不确定它是对还是错,如果错了请纠正我。我正在使用

进行恢复
MSBuild.exe /t:Restore MySln.sln

而不是 nuget restore 现在成功了。