Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
169 views
in Technique[技术] by (71.8m points)

c# - build .net application in Jenkins using MSBuild

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  

Could anyone plz help me out..??

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

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

enter image description here


Jenkins MSBuild Installation Configuration

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.

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

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.

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

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).

Jenkins MSBuild build-step, with (default) msbuild configuration selected

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.

Jenkins MSBuild build-step, with named msbuild configuration selected


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...