Setup .NET Project Build Using Jenkins

In my previous article, I explained what Jenkins is and how to set it up on a Windows machine. In this article, we will see how to setup a build in Jenkins for .NET MVC projects.

To start Jenkins, open the command prompt and go to the Jenkins folder, then type the below command.

java -jar jenkins.war


Open your browser and type localhost:8080, 


Enter your Admin User Id and Password.


It will navigate you to the Jenkins Dashboard. Here, you can see all the previously created items plus you can create a new one.


For configuring a new item click on 'New Item' as shown in the above screen.

Enter the name of the item you want to create (here I have entered VSTS_CI) and then select 'freestyle project' and click on 'Ok' button.

Now, there are 6 steps to configure, will see one by one.

Step 1

In the first tab, that is General, here you can enter the description of the Item and Check on discard old builds, it means it will automatically discard builds if they reach a certain age.

Here, I have set up a Strategy Log retention and three days to keep builds.


So, before we configure Source Code Management, we have VSTS account and Team Foundation Version Control so we need to install the plugin.

For that, select Manage Jenkins and Click on Manage Plugins.


Select the Team Foundation Server Plug-in and VS Team services Continuous Deployment Plugin.

Also, we need MS Build Plugin the same as the below screen.

Step 2

From the Source code management tab, will set the source team Foundation Version Control (TFVC). 


Enter the collection URL of VSTS, Like

Enter Project Path like $/MSTeamProject

From the Credential Drop down will set Manual and enter the VSTS Username and Password.


Step 3

Build the environment. Using this we can create and set a delivery pipeline version.

Step 4

From the Build step, we can set the Build Version, and set MSBuild File Path. That is your Jenkins Workspace path. C:\Users\.jenkins\workspace\project.sln 


Step 5

The last step is to setup Post-Build Action, You can select from the Dropdown based on your requirement.

We can set up Email Notification, Trigger Releases, Etc.


That's it, once you are done click on Save and Apply, now from the left panel, Click on Build the Item.

It will start the build and it will clone the data in the Workspace of Jenkins.

Once it's done, click on the build number and go to Workspace. You can see the latest Build code and files in the workspace as shown in the below screen.


I hope you like the article. Please give your feedback, comments, and suggestions in the comment box. In my next article, we will explore Continuous Integration and Release using Jenkins and Visual Studio Team Services for.Net MVC Project.

Similar Articles