Hoca Chen
4 min readOct 31, 2021

Build-Up a CI system by Jenkins. (Including Subversoin, MSbuild, UnitTest, and Mail system)

Photo by Fotis Fotopoulos on Unsplash

This article will share what I met when build-up Jetkines. The Jenkins function includes auto-SVN checkout, building the specified solution, running Unit Test with new SVN checkout, the final one is sending mail to complain about who has broken the code.

  1. Download the Jenkins from the website.

Download the .msi file for windows server OS on the website (https://www.jenkins.io/). I picked up LTS version.

2. Install it

This issue that I met is the logon service as photo:

For it, you need to modify your user rights of account.

3. Prepare your project

In my case, the version control is via SVN, there the first item that I need is:

3 parts that you needs to setup:

(1). In “configure system” of Jetkins, you need give a correct subversion version.

(2). subversion in your project

(3). How you want to trigger your project.

e.g. I trigger my project every 5 minutes

My project is running with Visual Stodio that I need MSBuild tool.

In “Global Tool Configuration” of JetKins, the MSBuild installation needs setup with name and path of MSBuild. e.g., I use Visual studio 2017

After, you can setup the setting in your project with Build section.

There have a framework requested for running Unit Test. For me, I use the NUnit, therefore I download the NUnit to install in my local.

Running Unit Test is via the Windows batch command. The project of Jenkins can be modified “Build” then “Run batch command for Unit Test”.

The batch command format for NUnit is quite sample.

e.g. “(your local path)\NUnit.org\nunit-console\nunit3-console.exe (your local path)\YourProjectName.UnitTest.dl

After, you can publish your test result for setting the Post-build Actions.

The Email part is most difficult for me, due to the network service. The most of case may use the Google server to send Email, but it may not work if your IT department has its own management authority. Anyway, let’s try use the Google server.

In “Configure System” of Jenkins, the E-Mail Notification section needs to setup as below. After, you can send a test mail to make sure its function.

In the Jenkins project, add one more action for Post-bulid Actions for E-mail Notification. In Recipients, you can typing the mail address that you want to notify. In my setting, is selected “separate-e-mails to individual who broke the build”. How Jenkins knows who should be got the mail? When Jenkins start check out SVN data by Poll SCM, the member can be memorized into “People” section in Dashboard of Jenkins. Here, you can modify the profile of People e.g. Email address. After that, Jenkins will follow the people last checking and send the mail if code is broken.

The Jenkins is a good tool that for you easily to setup your CI system. In my point of view, it can integrate with Windows command e.g. Batch, PowerShell.

It almost can do anything that you need for Windows. Hope this article can help you a little for beginner of Jenkins. Enjoy~

No responses yet