我正在尝试设置Jenkins服务器来构建ASP Core项目。我已将我的Jenkins项目配置为使用已安装的Visual Studio 2017中的MSBuild。我下载了Nuget v5.3.1并将其添加到PATH中。
我的Jenkins项目配置了两个构建步骤。第一步是运行nuget restore
。第二步是在我的解决方案文件(AspCore.sln
)上“使用MSBuild构建Visual Studio项目或解决方案”
当我尝试在Jenkins中构建项目时,出现以下错误。但是,看来所有Nuget软件包都已成功下载。
C:\Program Files\dotnet\sdk\2.1.509\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198,5): error NETSDK1064: Package Microsoft.VisualStudio.Web.CodeGeneration, version 2.1.9 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:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj]
这是完整的Jenkins构建日志。
Started by user Ben Rubin
Running as SYSTEM
Building in workspace C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment
using credential 633afff1-dea9-4aab-a44a-0a4d127afd1b
> git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git.exe config remote.origin.url git@github.com:Toreth/AspCoreTest.git # timeout=10
Fetching upstream changes from git@github.com:Toreth/AspCoreTest.git
> git.exe --version # timeout=10
using GIT_SSH to set credentials
> git.exe fetch --tags --force --progress -- git@github.com:Toreth/AspCoreTest.git +refs/heads/*:refs/remotes/origin/*
> git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
> git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10
Checking out Revision c0e95238b58d6648c51fac0a817fa5d3e60ce615 (refs/remotes/origin/master)
> git.exe config core.sparsecheckout # timeout=10
> git.exe checkout -f c0e95238b58d6648c51fac0a817fa5d3e60ce615
Commit message: "Initial commit."
> git.exe rev-list --no-walk c0e95238b58d6648c51fac0a817fa5d3e60ce615 # timeout=10
[Windows Service Deployment] $ cmd /c call C:\Windows\TEMP\jenkins4544019004588734090.bat
C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment>nuget restore
MSBuild auto-detection: using msbuild version '15.9.21.664' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\bin'.
Restoring packages for C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj...
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.design/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.design/index.json 45ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.design/2.1.9/microsoft.visualstudio.web.codegeneration.design.2.1.9.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.design/2.1.9/microsoft.visualstudio.web.codegeneration.design.2.1.9.nupkg 31ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegenerators.mvc/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegenerators.mvc/index.json 42ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegenerators.mvc/2.1.9/microsoft.visualstudio.web.codegenerators.mvc.2.1.9.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegenerators.mvc/2.1.9/microsoft.visualstudio.web.codegenerators.mvc.2.1.9.nupkg 30ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration/index.json 44ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration/2.1.9/microsoft.visualstudio.web.codegeneration.2.1.9.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration/2.1.9/microsoft.visualstudio.web.codegeneration.2.1.9.nupkg 29ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.entityframeworkcore/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.entityframeworkcore/index.json 58ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.entityframeworkcore/2.1.9/microsoft.visualstudio.web.codegeneration.entityframeworkcore.2.1.9.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.entityframeworkcore/2.1.9/microsoft.visualstudio.web.codegeneration.entityframeworkcore.2.1.9.nupkg 29ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.core/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.core/index.json 41ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.core/2.1.9/microsoft.visualstudio.web.codegeneration.core.2.1.9.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.core/2.1.9/microsoft.visualstudio.web.codegeneration.core.2.1.9.nupkg 30ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.templating/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.templating/index.json 42ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.templating/2.1.9/microsoft.visualstudio.web.codegeneration.templating.2.1.9.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.templating/2.1.9/microsoft.visualstudio.web.codegeneration.templating.2.1.9.nupkg 29ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.utils/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.utils/index.json 60ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.utils/2.1.9/microsoft.visualstudio.web.codegeneration.utils.2.1.9.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.utils/2.1.9/microsoft.visualstudio.web.codegeneration.utils.2.1.9.nupkg 30ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.contracts/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.contracts/index.json 61ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.contracts/2.1.9/microsoft.visualstudio.web.codegeneration.contracts.2.1.9.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.contracts/2.1.9/microsoft.visualstudio.web.codegeneration.contracts.2.1.9.nupkg 32ms
Installing Microsoft.VisualStudio.Web.CodeGeneration.Contracts 2.1.9.
Installing Microsoft.VisualStudio.Web.CodeGeneration.Utils 2.1.9.
Installing Microsoft.VisualStudio.Web.CodeGeneration.Templating 2.1.9.
Installing Microsoft.VisualStudio.Web.CodeGeneration.Core 2.1.9.
Installing Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore 2.1.9.
Installing Microsoft.VisualStudio.Web.CodeGeneration 2.1.9.
Installing Microsoft.VisualStudio.Web.CodeGenerators.Mvc 2.1.9.
Installing Microsoft.VisualStudio.Web.CodeGeneration.Design 2.1.9.
Committing restore...
Generating MSBuild file C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\obj\AspCore.csproj.nuget.g.props.
Generating MSBuild file C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\obj\AspCore.csproj.nuget.g.targets.
Writing assets file to disk. Path: C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\obj\project.assets.json
Restore completed in 3.73 sec for C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj.
NuGet Config files used:
C:\Windows\system32\config\systemprofile\AppData\Roaming\NuGet\NuGet.Config
C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config
Feeds used:
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
https://api.nuget.org/v3/index.json
Installed:
8 package(s) to C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj
C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment>exit 0
Path To MSBuild.exe: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe
Executing the command cmd.exe /C " chcp 1252 & "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" AspCore.sln " && exit %%ERRORLEVEL%% from C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment
[Windows Service Deployment] $ cmd.exe /C " chcp 1252 & "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" AspCore.sln " && exit %%ERRORLEVEL%%
Active code page: 1252
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 10/27/2019 4:54:18 PM.
Project "C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
Project "C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore.sln" (1) is building "C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj" (2) on node 1 (default targets).
C:\Program Files\dotnet\sdk\2.1.509\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198,5): error NETSDK1064: Package Microsoft.VisualStudio.Web.CodeGeneration, version 2.1.9 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:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj]
Done Building Project "C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj" (default targets) -- FAILED.
Done Building Project "C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore.sln" (default targets) -- FAILED.
Build FAILED.
"C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore.sln" (default target) (1) ->
"C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj" (default target) (2) ->
(ResolvePackageAssets target) ->
C:\Program Files\dotnet\sdk\2.1.509\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198,5): error NETSDK1064: Package Microsoft.VisualStudio.Web.CodeGeneration, version 2.1.9 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:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.44
Build step 'Build a Visual Studio project or solution using MSBuild' marked build as failure
Finished: FAILURE