Quick feedback to the developers and transparent information about the health of the projects. This post will focus on .NET application.
Small team of 3 developers. Two projects: .NET WPF client application and J2EE RESTful web service.
I've decide to use Jenkins as Continuous Integration server. I've use CrouseControl.NET in the past but was not so happy about it. TeamCity was another very good option and I've decide on Jenkins after all because of the strong community involvement and quick development around it, and also the fact that it is free and stay free was important factor.
Those instructions are given as-is without warranty. Use them at your own risk. You should ensure you have the proper license to run each tool on your machines.
- Download Jenkins for Windows.
- Run Jenkins setup. Install it in C:\CI\Jenkins (no spaces in name)
- Stop Jenkins service, open Jenkins.xml and change http port to 6080. Restart the service.
- Open http://localhost:6080 to confirm Jenkins installation
- Install GitExtensions to C:\CI\GitExtensions. Install msysgit co C:\CI\git
- Go into Jenkins configuration -> Plugins -> Available and install git plugin. Go into Jenkins -> Configuration and change Path to git execution to C:\CI\git\cmd\git.cmd (not git.exe)
- Change Jenkins windows service to run with specific Windows user by open the Services mmc, open the Properties dialog for Jenkins service and change the login user to a user in your machine.
- Login with the user and run command to create ssh public/private key: open git bash goto ~/.ssh and run ssh-keygen.exe -t rsa -C "firstname.lastname@example.org"
- Use the command cat id_rsa.pub in git bash to get the public key (remove new lines)
- Paste the public key in the remote git site (assembla, github).
- Create new build task. Choose git as SCM and enter your remote repository address.
- Run the build task, which will hang, stop it after few seconds and copy the command Jenkins execute. Paste that command into command line window and run it. You will get a message ask to approve the remote service fingure print, approve it.
- Run the task again and everything should work as planed.
- Go into Jenkins configuration -> Plugins -> Available and install MSBuild plugin
- Go into Jenkins configuration and under MSBuild click Add MSBuild in the name enter .NET 4 and in Path to MSBuild enter C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
- Download Windows SDK for .NET 4 - select GRMSDK_EN_DVD.iso. Install only ".NET Development" component. (Update: Please download Windows 8.1 SDK if you are using Windows 8 and above).
- Using this script copy MSTest related files from your development machine into CI server at C:\CI\MSTest
- Use gacutil from Windows SDK to register ".Resource.dll" and ".UnitTestFramework.dll" - it is important the files will have version 10.0.0.0 (not 10.1.0.0)
- Run mstest registry file [MSTest Registry Export] to add test types and other values request by MSTest to the CI server registry
- Go the the job configuration and add build step of type Execute windows batch command with the following command Test Batch Command
- Go into Jenkins configuration -> Manage Plugins -> Available -> and select JENKINS MSTest plugin
- Go into the build configuration. In the Post Build Actions check Publish MSTest test result report and write TestResult.trx in Test report TRX file
[MSTest Registry Export]
You will need to export values from your registry in order to run MSTest on Jenknis machine.
For 32bit machines export HKLM\SOFTWARE\Microsoft\VisualStudio\10.0\EnterpriseTools\QualityTools
For 64bit machines export HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\EnterpriseTools\QualityTools
If you have 64 bit developer machine and 32 bit Jenkins server just do search and replace of Wow6432Node\ to nothing to remove the 64 bit registry path part.
[Test Batch Command]del /f /q TestResult.trx
I've use the following posts and articles to build my Jenkins server.