当我在 Jenkins 构建服务器上构建 .NET Standard 2.0 库时
C:\Program Files\dotnet\sdk\2.1.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198,5): error : Assets file 'C:\Jenkins\workspace\<Project>\Sources\Library\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. [C:\Jenkins\workspace\<Project>\Sources\Library\Library.csproj]
我在构建日志中收到上面的错误。
我搜索了错误,发现solution https://github.com/Microsoft/vsts-tasks/issues/3762
但是,运行时:
dotnet restore <Solution Name>
当我在构建开始之前清理工作区时,该解决方案对我没有帮助。
因此,我在 MSBuild 之前插入命令,但失败了
C:\Program Files\dotnet\sdk\2.1.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198,5): error : Package Microsoft.CodeAnalysis.CSharp.Workspaces, version 2.8.0 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. [C:\Jenkins\workspace\<Project>\Sources\Web\Web.csproj]
根据解决方案参考 https://github.com/Microsoft/vsts-tasks/issues/3762,也许升级Nuget 包安装程序可以帮助我。但不知道如何升级Nuget 包安装程序通过命令行...