使用 MSBuild 在 Jenkins 中构建 .net 应用程序 [英] build .net application in Jenkins using MSBuild

查看:17
本文介绍了使用 MSBuild 在 Jenkins 中构建 .net 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基于 .net framework 3.5 的 .net 应用程序,我正在尝试在 Jenkins CI 服务器上构建这个应用程序.我添加了 MSBuild 插件,并添加了 2.0、3.5 和 4.0 版 MSBuild 的 .exe 文件的路径.但是我的构建过程因显示以下错误消息而失败.

I have a .net application built on .net framework 3.5, I am trying to build this application on Jenkins CI server. I've added MSBuild plugin and and have added path to the .exe file of 2.0, 3.5 and 4.0 versions of MSBuild. But my building processes are failing by showing the below error message.

Path To MSBuild.exe: msbuild.exe  
Executing command: cmd.exe /C msbuild.exe Neo.sln && exit %%ERRORLEVEL%%  
[Test project] $ cmd.exe /C msbuild.exe Neo.sln && exit %%ERRORLEVEL%%  
'msbuild.exe' is not recognized as an internal or external command,  
operable program or batch file.  
Build step 'Build a Visual Studio project or solution using MSBuild.' marked uild as failure  
Finished: FAILURE  

谁能帮帮我..??

推荐答案

要使 MSBuild 插件工作,您需要在 Jenkins 管理屏幕中配置该插件.

To make the MSBuild plugin work, you need to configure the plugin in the Jenkins management screen.

注意:在较新的 Jenkins 版本中,您可以在全局工具配置中找到 MSBuild 配置:

NOTE: in the newer Jenkins versions you find the MSBuild configuration in the Global Tool Configuration:

注意名称"字段,我将这个特定配置称为 v4.0.30319.您可以随意称呼它,但理想情况下,名称会以某种方式指代版本.

Note the "Name" field, where I've called this particular configuration v4.0.30319. You could call it anything you like, but ideally the name will somehow refer to the version.

您稍后需要在失败的 Jenkins 项目中引用此名称.

You'll need to refer to this name later in the Jenkins PROJECT that's failing.

注意:黄色警告意味着 Path to MSBuild 字段应填充目录名而不是文件名.实际上,您也需要在此处输入文件名(即 msbuild.exe),否则构建步骤将失败.

Note: The yellow warning implies that the Path to MSBuild field should be populated with a directory name rather than a file name. In practice you do need to enter the filename here too (ie. msbuild.exe) or the build step will fail.

在失败的 Jenkins 项目中,转到 MSBuild 构建步骤.

In the Jenkins project that's failing, go to the MSBuild build step.

构建步骤中的第一个字段是MSBuild 版本".如果您在配置任何 MSBuild 版本之前创建了构建步骤,则此处的值将为(默认).

The first field in the build step is "MSBuild Version". If you created the build step before configuring any MSBuild versions, the value here will be (default).

配置一个或多个 MSBuild 版本后,下拉列表将填充可用配置.选择您需要的那个.

After configuring one or more MSBuild versions, the drop down will be populated with the available configurations. Select the one you require.

您可以在此处看到我现在选择了与上述安装匹配的命名配置.

You can see here that I've now selected the named configuration that matches the installation above.

这篇关于使用 MSBuild 在 Jenkins 中构建 .net 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆