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 https://csharpcorner.visualstudio.com/
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.
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.
From the Source code management tab, will set the source team Foundation Version Control (TFVC).
Enter the collection URL of VSTS, Like https://csharpcorner.visualstudio.com/
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.
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.


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.

porus vPosted Sep 27, 2019, 5:41 AM
Can you please give me any example project on c# in declarative pipeline
porus vPosted Sep 27, 2019, 5:18 AM
Can you please c# project on declarative piipeline
ayed ramadeenPosted Apr 10, 2019, 2:27 PM
Many thanks man, this way is simple and easy :)
Mehdi QorbanpurPosted Apr 1, 2019, 4:52 PM
Thanx a lot!
baris karabayPosted Jan 7, 2019, 4:51 AM
Hi, when I do Deploy. Workspace is full but. Folders are empty on the IIS server. view content is empty
Rushi MehtaPosted Aug 10, 2018, 4:33 AM
Truely Knowledgeable Article
balakrishna maddhurPosted Aug 10, 2018, 12:21 AM
Thank you for sharing sir.It is very helpful to new beginners.