a blog for those who code

Monday 24 October 2016

How to build Visual Studio project using MSBuild in Jenkins

In this post we will be discussing about building a Visual Studio project or solution using MSBuild in Jenkins. Jenkins is an application that monitors execution of repeated jobs, such as building a software project or jobs run by cron.

At first you need to install a MSBuild plugin which will make it possible to build Visual Studio project(.proj) and solution files(.sln). You need to specify the location directory of MSBuild.exe on Jenkin's configuration page and the name. If you have multiple MSBuild versions installed, you can configure multiple executable's with different name.

To add a build step in your project pipeline you need to select "Build a Visual Studio project using MSBuild". Once you have selected that you need to specify the version and the build file as shown below

We have selected the command line arguments as /t:ReBuild;Package /p:Configuration=Debug which will builds the rebuild target with the debug configuration.

If you want to deploy after the build step then we will use one more build step and add an Execute Windows batch command as shown below

msdeploy.exe -verb:sync -source:package="test.zip" -dest:auto,computerName="ComputerName",authType=Basic,username=username,password=password -allowUntrusted=true -setParamFile="parameters" -skip:absolutePath=.*web\.config

Please Like and Share the Blog, if you find it interesting and helpful.


  1. Hey Hemanth, can you help me here on MsBuild package issue below:

    While creating a Package(.Zip) using MSBuild (App developed in Visual C# 2013 targeting v4.0.30319\msbuild.exe) is creating these files under obj\Release\Package --SetParameters.xml, a project.zip file, .SourceManifest and .deploy.cmd; which is all good until here...

    But, in SetParameters.xml File Msbuild is adding _deploy afterApplication name, I wanted to get rid of that(_deploy) without editing the file for my Continuous deployment. So that, Msdeploy command can refer SetParameters.xml and uses .zip file to deploy to Correct Virtual Directory on Destination Server.

    SetParameters.xml File :


  2. Naveen, I'm having the same issue, did you ever find a resolution?