Last week I started working on the build scripts for my new project.  I've worked on build environments in the past, but I didn't really commit everything to memory.  Thus, I have had to reinvent the wheel in some ways.  So far I have established commit and nightly builds.  Each build cleans up after the previous build, retrieves the latest source, compiles the application, and runs the tests under coverage.  The tools of choice: CruiseControl.Net, Subversion, NUnit, NCover, and MSBuild.

Originally, I planned to use NAnt because I had used it in the past and was somewhat familiar with it.  However, as I am developing on .Net 3.x and using Visual Studio 2008, I decided to take a look at MSBuild.  I did quite a bit of Googling before getting started to look for comparisons between NAnt and MSBuild.  As you can imagine, there were quite a few opinions.  What I discovered is that NAnt seems to give more power where MSBuild can be more usable for build newcomers.  I am not exactly a newcomer, but it has been a while since I used NAnt and I really don't need the power it provides.  This is what led me to use MSBuild.  Ultimately, after a couple of hours of research, it turned out to be relatively straight forward to put together a build script.

One of the nice advantages of MSBuild is that it is packaged with the .Net Framework.  Also, there is a nice MSBuild folder where you can dump common target files.  This is also where I deployed the MSBuildCommunityTasks extension that I use to integrate with SVN.  This folder is easily referenced using a built in property: MSBuildExtensionsPath.  If you are like me, then you probably have more than one project to maintain.  Because of this, I have moved common targets (like getting the latest source) to this folder.  In fact, as the build process will basically be the same for all of my projects, I have put most of my targets in the common file.  All I have to do is import the common target file in my project and set a few properties.  This works out quite nicely and allows me to streamline my project build file.  It also reduces copy/paste reuse.

I still have a ways to go.  I have only been playing with build configuration on my local machine.  I have some rough documentation on the process that I expect to refine when I repeat it on the build server.  Also, I haven't done anything with the database yet.  Check out Snapshot or Change Scripts? regarding my thoughts on the subject.  I think I have decided on using change scripts, but as I haven't tried it yet, I reserve the right to change my mind.

Tags: ,
posted on Thursday, February 7, 2008 9:13 AM
Filed Under [ Builds & CI MSBuild ]


No comments posted yet.

Post A Comment