詹金斯无法找到msbuild

时间:2019-02-27 14:14:33

标签: jenkins msbuild

Jenkins入门。我会尽快学习!尝试在工具配置中设置msbuild。我有这个:

enter image description here

然后我设置了一个工作,以使用显式设置进行构建,并使用上面的msbuild进行构建:

enter image description here

当我运行此作业时,第一个构建成功,但第二个失败:

D:\var\lib\jenkins\workspace\VisionTest>"c:\program files (x86)\msbuild\14.0\bin\msbuild.exe" TBSM.Vision.Database\TBSM.Vision.Database\TBSM.Vision.Database.sqlproj 
Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 2/27/2019 9:05:25 AM.
Project "D:\var\lib\jenkins\workspace\VisionTest\TBSM.Vision.Database\TBSM.Vision.Database\TBSM.Vision.Database.sqlproj" on node 1 (default targets).
GenerateSqlTargetFrameworkMoniker:
Skipping target "GenerateSqlTargetFrameworkMoniker" because all output files are up-to-date with respect to the input files.
CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
SqlBuild:
Skipping target "SqlBuild" because all output files are up-to-date with respect to the input files.
CopyFilesToOutputDirectory:
  TBSM.Vision.Database -> D:\var\lib\jenkins\workspace\VisionTest\TBSM.Vision.Database\TBSM.Vision.Database\bin\Debug\TBSM.Vision.Database.dll
SqlPrepareForRun:
  TBSM.Vision.Database -> D:\var\lib\jenkins\workspace\VisionTest\TBSM.Vision.Database\TBSM.Vision.Database\bin\Debug\TBSM.Vision.Database.dacpac
Done Building Project "D:\var\lib\jenkins\workspace\VisionTest\TBSM.Vision.Database\TBSM.Vision.Database\TBSM.Vision.Database.sqlproj" (default targets).

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:04.35

D:\var\lib\jenkins\workspace\VisionTest>exit 0 
FATAL: "c:\program files (x86)\msbuild\14.0\bin\msbuild.exe"  doesn't exist
Build step 'Build a Visual Studio project or solution using MSBuild' marked build as failure
Finished: FAILURE

我认为只是我是菜鸟。为什么Jenkins在第一个构建步骤中找到msbuild.exe但在第二个构建步骤中找不到?我需要更改什么?

更新:我也这样尝试过:

enter image description here

并在作业配置中选择了MSBuildAgent,但我仍然得到:

FATAL: "c:\program files (x86)\msbuild\14.0\bin\"  doesn't exist
Build step 'Build a Visual Studio project or solution using MSBuild' marked build as failure
Finished: FAILURE

2 个答案:

答案 0 :(得分:3)

Jenkins社区发现了我的错误:

Remove the double quotes surrounding the path

感谢Lionel Cabasson

答案 1 :(得分:0)

在“全局工具”配置中,您需要指定msbuild.exe的完整路径并包括文件名。忽略错误消息,它是一条红色鲱鱼。注意:路径周围不需要双引号。

MSBuild Config

在自由式作业中使用此工具定义需要执行“使用MSBuild构建Visual Studio项目或解决方案”步骤,而不是Windows Batch步骤。

在自由式工作中:

  1. 从下拉列表中选择要使用的MSBuild版本 像你一样列出来。
  2. 输入项目的WORKSPACE相对路径(最好是 解决方案)文件。
  3. 在命令行参数中输入/ t:Clean
  4. 重复此步骤,但细节相同,但第二步 输入/ t:Rebuild到命令行参数

建议您从Freestyle作业迁移到管道。