index-1-1.jpg
  • Aurora Solutions

Using MSBuild with CCNet

This is the third article of the series of Continuous Integration in .net, in the previous article, I had explained the continuous integration CI and setting up the cruise control .net. In this article I will explain the tasks tag in the ccnet config file and using MSBUILD to compile your .net project, and I will tell how you can automate your build process.


Task Tag:

Up till now we have seen how to set up Cruise Control, get the latest source code from the repository and set up the feed back system. Now the next aim is to compile the newly fetched code, we can do it by a task in cruise control. Task tag have several extensions and can be used in many ways. But for this article we will use this to compile our .net project.


MSBuild is a free build tool shipped with Microsoft .Net framework. It’s very powerful tool to build your .net projects. You don’t need to go for any other tools for building your scripts. MSBuild has an automated script to build Visual Studio solution and project files. So the MSBuild and Visual Studio are perfect couple. There are couple of ways to build .net projects using MSBuild, but here I will build the complete solution file.


So we define a msbuild section in our tasks tag to build our solution file. Here is the code how we can achieve this.

<tasks>

<msbuild>

<executable>C:WindowsMicrosoft.NETFrameworkv4.0.30319MSBuild.exe</executable>

<workingDirectory>D:Reposcruisecontrol</workingDirectory>

<projectFile>D:ReposcruisecontrolAurora_UIAurora_UI.sln</projectFile>

<buildArgs>/P:Configuration=Release /t:Rebuild</buildArgs>

<logger>C:Program Files (x86)CruiseControl.NETserverThoughtWorks.CruiseControl.MSBuild.dll</logger>

</msbuild>

</tasks>

As in this code first we select the msbuild executable which comes with .net framework and is located in C:WindowsMicrosoft.NETFrameworkv4.0.30319 , than we specify solution/project file using <projectFile> property and adding the arguments, we have define that the project should rebuild in the release mode. The logger file is used to log the build results during compiling the program.


Using the above code the solution will be build. Now the next step is to include the build result in the mail. We had discussed about XSL files in the previous article. Now we use them to get the desired results in the email. The following xsl files should be added in the email publisher.

<xslFiles>
<file>xslheader.xsl</file>
<file>xslcompile.xsl</file>
<file>xslunittests.xsl</file>
<file>xslmodifications.xsl</file>
<file>xslfit.xsl</file>
<file>xslcompile-msbuild.xsl</file>
<file>xslNCoverSummary.xsl</file>
</xslFiles>

In the following snippet the compile-msbuild.xsl will be responsible for the msbuild results indicating the errors in the project also the warnings. These xsl files are already available with cruise control so you just need to include them in the configuration file. When we run the cruise control using this configuration we get our .net project build successfully with the following warnings you will receive in your email.


You can see the various warnings about the project in the image which comes in email, you can also watch this in the web dashboard. So this was all about using MSBuild with cruise control. In next article we will discuss about NAnt tasks, and will shift our msbuild task in the NAnt.

Previous articles link:

2. Getting started with Cruise Contrl .NET

1. Introduction to Continuous Integration

Download Project & Configuration File

1 view0 comments

Recent Posts

See All

Automating WIX Installer using CCNET

This is the last article of the series Continuous Integration in .NET using Cruise Control.net. In the last article we had discussed that how we can use NUnit with ccnet to run our test cases. In this

Using NAnt with CCNet

This is the fourth article of the series. In the last article we had seen the usage of MSBuild. In this article we will look at the NAnt. NAnt is free and open source software for automating the build

Using NUnit with CCNet

This is the fifth article of the series of Continuous Integration in .net using Cruise Control .net. In the last article we had covered the usage of NAnt with ccnet, in this article we move ahead and