In my last article, I talked about using MSBuild with Web Deployment Projects (WDP), an add-in to Visual Studio that allows you to create MSBuild files for web projects. WDP enables you to manage not only build configuration and merge options, but other tasks such as specifying changes for the application's Web.config file during compilation, changing connection strings, creating virtual directories, and performing other tasks at specific points in the deployment process. Although this adds a lot of flexibility I have found that Web Application Projects (WAP) offers a better solution. WAP provides another web project model option for Visual Studio 2005 that can be used as an alternative to the built-in web-site based solution. It uses the same project, build and compilation semantics as the Visual Studio 2003 web project model. Specifically (from the web site):
- All files contained within the project are defined within a project file (as well as the assembly references and other project meta-data settings). Files under the web's file-system root that are not defined in the project file are not logically considered part of the web project.
- All code files within the project are compiled into a single assembly (that gets built and persisted in the \bin directory on each compile).
- The compilation system uses a standard MSBuild based compilation process. This can be extended and customized using standard MSBuild extensibility rules. You can therefore control the build through the property pages, so for example, you can name the output assembly.
Installing WAP does not modify or affect the behavior of Visual Studio 2005, it simply adds a new project type to Visual Studio. WAP is still in beta and there are some known issues that you should read and be aware of before using it. A new version is due out this month that will fix most of the bugs and problems with the existing version. I will be using WAP in this article as my web project type.
On my build server I'm running Windows Server 2003 with IIS 6.0 with CruiseControl.NET 1.0.1251 installed. You can download CruiseControl.NET here if you don't have it installed. For source control I'm going to use Visual SourceSafe 2005, although you could plug in any source control system (Vault, Subversion, etc.). I'll also be using the MSBuild Community Tasks Project library. The current version is 126.96.36.199, but I'm using a newer version that hasn't been released since I'm a contributing member of the project. You can download the latest version of the source code from the project home page, but you'll have to build the project once you download it. A new version of the library is due out very soon, so stay tuned.
Previous to .NET 2.0 being released, I used CruiseControl.NET (CC.NET) with NAnt, both of which are freely available as open source projects. MSBuild and NAnt are both build tools that allow you to perform a myriad of tasks from building solutions to running unit tests, zipping up the output of builds, transforming XML with XSLT, accessing source control, sending email, etc. Both tools are extremely powerful. Now that .NET 2.0 has been released, MSBuild has become the build tool of choice for Visual Studio solutions. After all, the project files that are created by Visual Studio are created for MSBuild. What I am going to do is show you how I have integrated MSBuild with CC.NET to create a continuous integration process.
The continuous integration process I'm going to emulate will look like the following:
The trigger for CC.NET to launch a build will be the source control repository. CC.NET offers several different Trigger blocks that control how a build will get launched. Some of the different types can be an Interval Trigger, a Scheduled Trigger, or a Filter Trigger. The most common trigger used is the Interval Trigger. The Interval Trigger allows you to specify that a build should be run periodically, after a certain amount of time. By default, a build will only be triggered if source control modifications have been detected since the last build. The trigger can also be configured to force a build even if no changes have occurred to the source control repository. Another nice feature is that you can nest trigger types together. For example, you can use a Filter Trigger to specify that a build should not be performed in a certain time period. You can then nest an Interval Trigger to specify the normal build conditions. Here is an example of this in the CC.NET's server configuration file (I'll refer to this as ccnet.config from now on):
10 <filterTrigger startTime="0:00" endTime="6:00">
11 <trigger type="intervalTrigger" seconds="300" />
The outer Filter Trigger indicates that the build should not occur from midnight until six in the morning. The inside Interval Trigger then specifies that the build should occur every five minutes.
The next step I need to setup in the ccnet.config file is the retrieval of the source code. Before I show that, I'd like to talk about the structure of the Visual Studio solution. This is important because when CC.NET retrieves the source code it will need to know where the master MSBuild project file resides. Here is a quick glance of the solution in Visual Studio:
There are four projects, a data layer, business layer, presentation layer, and a unit test project. I have also specified a folder for solution items. In this folder I will place the master MSBuild project file, along with other solution-wide items, including a sample strong name key. The project structure inside VSS looks like the following:
When CC.NET gets the latest version of the solution from VSS, it will create a file structure exactly like this. Now that you know where the main MSBuild project file will be when you perform the GET from VSS, you can then specify the location in the ccnet.config file. Here are the SourceControl and MSBuild blocks:
243 <sourcecontrol type="vss">
244 <executable>C:\Program Files\Microsoft Visual SourceSafe\ss.exe</executable>
261 <logger>ThoughtWorks.CruiseControl.MsBuild.XmlLogger,C:\Program Files\CruiseControl.NET\webdashboard\bin\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
The source control task gets the entire solution from VSS and places it into the value of the workingDirectory property. Once that is complete, CC.NET launches the MSBuild task by pointing the workingDirectory and projectFile properties to the source code. I'm also passing a property to the MSBuild project file through the buildArgs property. I use this property in the MSBuild project file to determine certain property settings. I also set the default target so that the MSBuild project file will know which target to execute first.
Configuring the MSBuild Project File
In the MSBuild project file, the first thing I check is the BuildType property that is passed from CC.NET so that I can initialize certain properties for the build:
3 <!-- BuildType Properties -->
5 <When Condition="'$(BuildType)' == 'Dev'">
15 <When Condition="'$(BuildType)' == 'Stage'">
24 <When Condition="'$(BuildType)' == 'QA'">
33 <When Condition="'$(BuildType)' == 'Prod'">
After determining the value of the 'BuildType' property, I set the deployment folder that the build will use for deployment, the configuration type, whether or not to produce debug symbols, and two values for the 'VersionBuildType' and 'VersionRevisionType'. These two values will be used by the Version task when I strong name the assemblies. I then proceed to setup several other properties and item groups that I will use during the build. I'll go through each one:
44 <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
45 <!-- Default build group is 'Build', other is 'NUnit' - See ItemGroup <VSProjects> -->
46 <BuildGroup Condition="'$(BuildGroup)' == ''">Build</BuildGroup>
62 <DeveloperBuild Condition="'$(DeveloperBuild)' == ''">False</DeveloperBuild>
In this property group I'm setting up a number of properties that deal with directory paths, source control username/password, and NUnit processing. I also add a property for the .targets file for the MSBuild Community Tasks Project library. This allows me to have access to all of the MSBuild tasks in that library without having to add a UsingTask element for every task I need to use. I then call the Import element to import all of the tasks:
66 <Import Condition="Exists($(ImportTargets))" Project="$(ImportTargets)" />
The directory structure on the build server that CC.NET will use looks like the following:
There are a few more items I create before any of the targets are executed. I create two item groups for cleaning the build directories. The first, CleanOutput, cleans the output directories after the projects are compiled. The second item group, CleanSource, is a collection of the directories to clean before compilation takes place. Here are the item groups:
102 <CleanOutput Include="$(BuildPath)" />
103 <CleanOutput Include="$(DocumentationPath)" />
104 <CleanOutput Include="$(UnitTestPath)" />
108 <CleanSource Include="$(LibraryPath)" />
109 <CleanSource Include="$(SourcePath)\Business" />
110 <CleanSource Include="$(SourcePath)\Data" />
111 <CleanSource Include="$(SourcePath)\Tests" />
112 <CleanSource Include="$(SourcePath)\Web.UI" />
I then create an item group for all of the projects in the solution:
115 <!-- VS Projects -->
117 <VSProjects Include="$(SourcePath)\Data\$(ProjectNamespace).Data.csproj">
120 <Description>Data layer.</Description>
123 <VSProjects Include="$(SourcePath)\Business\$(ProjectNamespace).Business.csproj">
126 <Description>Business layer.</Description>
129 <VSProjects Include="$(SourcePath)\Web.UI\$(ProjectNamespace).Web.UI.csproj">
132 <Description>Web presentation layer.</Description>
135 <VSProjects Include="$(SourcePath)\Tests\$(ProjectNamespace).Tests.csproj">
138 <Description>Unit test assembly.</Description>
For each VSProjects item, I'm also declaring metadata values that I can access during the build. The 'Group' metadata value allows me to separate regular build projects from NUnit test projects. I added that option in case I wanted to run the build file manually and only run the unit tests. This was purely optional and for this article I'll only be using the Build projects (although I do run the unit tests later). I'm also setting metadata for the 'Title' and 'Description' for each project. These values are used for when I strong name the assembly (I'll get to that in a minute).
I then create an item group that I'll use when building the NUnit projects. This collection represents anything that I'll need for generating the NUnit report. These items will get copied to the NUnitTestPath folder declared earlier.
143 <!-- Content files to copy to the test directory -->
144 <!-- Provide metadata <SubDirectory> for relative destination directory -->
145 <NUnitContents Include="$(SourcePath)\$(NUnitReportXslFilename)">
The last item group I declare is the XSL file that will be used to generate the NUnit report.
151 <NUnitReportXslFile Include="$(SourcePath)\$(NUnitReportXslFilename)">
As I mentioned earlier, you can pass the targets to execute in the MSBuild file from the CC.NET configuration file (ccnet.config) through the 'buildArgs' property. This allows you to call a specific target in the build file, which in this case, is 'Build'. To give you a quick overview of the targets I have in my build file I have them listed here:
I numbered the targets to denote the order in which they are executed. Build is called first, but it depends on AssemblyInfo. AssemblyInfo depends on CheckoutVersionFile. CheckoutVersionFile depends on CreateWorkingFolders. Based on all of that, CreateWorkingFolders executes first, then CheckoutVersionFile, then AssemblyInfo, and then finally Build. The Build target calls ParseTokens and then proceeds to build all of the projects in the solution. After compilation, the Build target then calls the UnitTest target and then DeployBuild. DeployBuild calls the Documentation target internally.
Here is the listing for the Build, AssemblyInfo, CheckoutVersionFile, and CreateWorkingFolders targets:
160 <Target Name="CreateWorkingFolders" Condition="'$(BuildGroup)' == 'Build'">
161 <!-- Clean the output folders -->
162 <RemoveDir Directories="@(CleanOutput)" />
164 <MakeDir Condition="!Exists('$(DocumentationPath)')" Directories="$(DocumentationPath)" />
165 <MakeDir Condition="!Exists('$(BuildPath)')" Directories="$(BuildPath)" />
166 <MakeDir Condition="!Exists('$(UnitTestPath)')" Directories="$(UnitTestPath)" />
169 <Target Name="CheckoutVersionFile" Condition="'$(BuildGroup)' == 'Build'"
171 <!-- Checkout BuildNumber.txt -->
172 <VssCheckout UserName="$(VssUsername)"
177 Path="$/DougRohm/Articles/MSBuildAndCCNet/Version.txt" />
179 <!-- Get Build and Revision number -->
180 <Version VersionFile="$(SourcePath)\Version.txt" BuildType="$(VersionBuildType)" RevisionType="$(VersionRevisionType)">
181 <Output TaskParameter="Major" PropertyName="Major" />
182 <Output TaskParameter="Minor" PropertyName="Minor" />
183 <Output TaskParameter="Build" PropertyName="Build" />
184 <Output TaskParameter="Revision" PropertyName="Revision" />
186 <Message Text="Version: $(Major).$(Minor).$(Build).$(Revision)" />
189 <Target Name="AssemblyInfo" Condition="'$(BuildGroup)' == 'Build'"
190 DependsOnTargets="CheckoutVersionFile" Inputs="@(VSProjects)"
193 <!-- For each VS project, create the AssemblyInfo.cs file -->
194 <AssemblyInfo CodeLanguage="CS"
199 AssemblyProduct="MSBuild and CruiseControl.NET"
200 AssemblyCopyright="Copyright © 2005-2006 Douglas Rohm"
204 AssemblyKeyFile="..\..\..\DougRohm.Articles.snk" />
207 <Target Name="Build" DependsOnTargets="AssemblyInfo">
208 <CallTarget Targets="ParseTokens" />
210 <MSBuild Projects="@(VSProjects)" Condition="'%(Group)' == '$(BuildGroup)'"
212 <Output TaskParameter="TargetOutputs" ItemName="BuildTargetOutputs"/>
215 <Copy SourceFiles="@(BuildTargetOutputs)"
217 Condition="'$(BuildGroup)' == 'Build'"
218 SkipUnchangedFiles="true" />
219 <Copy SourceFiles="@(BuildTargetOutputs->'%(RootDir)%(Directory)%(Filename).pdb')"
221 Condition="'$(BuildGroup)' == 'Build' And '$(Configuration)' == 'Debug'"
222 SkipUnchangedFiles="true" />
223 <Copy SourceFiles="@(BuildTargetOutputs->'%(RootDir)%(Directory)%(Filename).xml')"
225 Condition="'$(BuildGroup)' == 'Build'"
226 SkipUnchangedFiles="true" />
228 <!-- Run NUnit tests and generate report -->
229 <CallTarget Targets="UnitTest" />
231 <!-- Deploy project -->
232 <CallTarget Targets="DeployBuild" />
The first thing that happens is CreateWorkingFolders cleans out the BuildPath, DocumentationPath, and UnitTestPath folders by deleting the folders and then recreating them. Next, the CheckoutVersionFile target checks out the version file (Version.txt). The version file is used by the Version task so that it can reference it to generate the next version for the build. The version file resides in the Solution Items folder in Visual Studio. I then generate the new version by executing the Version task. Notice that I'm using the VersionBuildType and VersionRevisionType properties that I set in the Choose element at the beginning of the build file. Next, the AssemblyInfo target executes and generates the AssemblyInfo.cs file with all of the appropriate assembly attributes and places it in the projects Properties subfolder. The AssemblyInfo target has both Inputs and Outputs parameters. The Inputs parameter is a collection of all the Visual Studio projects that need to be built. The Outputs parameter is the AssemblyInfo.cs file that will replace the existing AssemblyInfo.cs file in the Properties directory.
At this point, tasks in the Build target can execute. The first thing the Build target does is call the ParseTokens target. This target is used to do any last minute modifications to the source files before compilation. In the Web.UI project there is the Default.aspx page. Near the bottom of the page there are two tokens I added for the application version and build date (@VERSION@ and @DATE@). The ParseTokens target will replace these tokens with the values I need. The first thing I do is create an item group named ParseIncludeFiles that contains all the files I want to parse, excluding the files I want to ignore. One thing I need to mention at this point is that I'm creating this item group on the fly, as opposed to creating it with all the other properties and item groups at the beginning of the build file. The reason for this is because all properties and item groups are evaluated before any targets. If I had declared this item group before the target, no output files would be in the source directory to be included in the item group (or excluded in this instance).
After I create the item group of files to parse, I get the current timestamp of the build using the Time task. I then call the FileUpdate task passing the ParseIncludeFiles item group along with the RegEx pattern for @VERSION@ and the replacement text. The replacement text is the $(Major), $(Minor), $(Build), and $(Revision) properties that were calculated in the CheckoutVersionFile target. Next, I call FileUpdate again passing in the ParseIncludeFiles item group with a RegEx pattern for @Date@ and it's replacement text. The replacement text for @DATE@ is the value from the Time task, $(BuildDate).
The last step in the ParseTokens target is a call to the Script task that will execute a custom script that I have declared with the other properties at the beginning of the build file:
71 public static void ScriptMain()
73 XmlDocument wcXml = new XmlDocument();
76 XmlElement root = wcXml.DocumentElement;
77 XmlNodeList connList = root.SelectNodes("//connectionStrings/add");
78 XmlElement elem;
80 foreach (XmlNode node in connList)
82 elem = (XmlElement)node;
84 switch (elem.GetAttribute("name"))
86 case "Northwind":
87 elem.SetAttribute("connectionString", "server=stageServer;database=Northwind;UID=web;PWD=pass");
89 case "pubs":
90 elem.SetAttribute("connectionString", "server=stageServer;database=pubs;UID=web;PWD=pass");
I added this task call as an example on request from an email I got from a reader. This task will execute the code in the UpdateWebConfigCode property. The code will replace the connectionStrings in the web.config file so that it can be used on another web server after deployment. When the project is deployed from the dev server to the staging server the connectionStrings will be updated and no manual modification will be needed. Again, this is just an example of how you could modify specific configuration settings with MSBuild.
Now that ParseTokens is complete, the next step in the Build target is to run MSBuild on the projects in the VSProjects item group. There is a condition on the MSBuild task call to only build the project if the item 'Group' is equal to the BuildGroup property, which is set to Build by default. The MSBuild task call also passes the Configuration property and creates an output item group called BuildTargetOutputs. After the MSBuild task call completes building each project, I copy the BuildTargetOutputs to the $(BuildPath)\bin folder. I also copy the .pdb files to the same directory if the Configuration is set to Debug. Lastly, I copy the XML documentation file to the same folder. All of this happens for all the projects in the VSProjects item group.
The next task to run in the Build target is to run the unit tests. I do this by calling the UnitTest target directly. There is a condition on the UnitTest target that checks the BuildType property and will only run if the BuildType is set to 'Dev'. In my build scenario, I only want to run my unit tests when building for the Dev environment. If you want to run your unit tests in other environments simply modify this condition. Here is the target with explanation below:
270 <Target Name="UnitTest" Condition="'$(BuildType)' == 'Dev'">
271 <!-- Set BuildGroup to 'NUnit' -->
272 <CreateProperty Value="NUnit">
273 <Output TaskParameter="Value" PropertyName="BuildGroup" />
276 <!-- Build the VSProjects of the 'NUnit' BuildGroup -->
277 <MSBuild Projects="@(VSProjects)" Condition="'%(Group)' == '$(BuildGroup)'"
279 <Output TaskParameter="TargetOutputs" ItemName="BuildTargetOutputs"/>
282 <!-- Create ItemGroup for test assemblies -->
283 <CreateItem Include="$(UnitTestPath)\%(NUnitContents.SubDirectory)\bin\$(Configuration)\$(ProjectNamespace).Tests.dll">
284 <Output TaskParameter="Include" ItemName="NUnitFiles" />
287 <Copy SourceFiles="@(BuildTargetOutputs)"
289 Condition="'$(BuildGroup)' == 'NUnit'"
290 SkipUnchangedFiles="true" />
292 <!-- Copy test files to the test directory -->
293 <Copy SourceFiles="@(NUnitContents)" DestinationFolder="$(UnitTestPath)\%(NUnitContents.SubDirectory)" SkipUnchangedFiles="true" />
295 <!-- Execute and report the NUnit tests -->
296 <NUnit Assemblies="@(NUnitFiles)"
299 ContinueOnError="true" />
301 <!-- Generate NUnit report from NUnit test results -->
302 <Xslt Inputs="@(NUnitFiles->'$(UnitTestPath)\%(Filename)$(NUnitPostfix)')"
304 Output="$(UnitTestPath)\TestReport.html" />
306 <!-- Set BuildGroup back to 'Build' -->
307 <CreateProperty Value="Build">
308 <Output TaskParameter="Value" PropertyName="BuildGroup" />
The first thing I do is set the BuildGroup property to 'NUnit'. This allows me to only compile the projects in the 'NUnit' group that I declared above in the VSProjects item group. The MSBuild task call also passes the Configuration property and the BuildGroup property and creates an output item group called BuildTargetOutputs. After the MSBuild task call completes, the BuildTargetOutputs is copied to the $(UnitTestPath)\%(NUnitContents.SubDirectory)\bin\$(Configuration) folder. I then create an item group called NUnitFiles that contains the unit test assemblies that will be used by the NUnit task below. I also copy the NUnitContents item group to the $(UnitTestPath)\%(NUnitContents.SubDirectory) folder. This is where the .xsl file will reside for translating the unit test results.
The next step involves calling the NUnit task that will run the unit tests based on the unit test project assembly (the NUnitFiles item group contains the test assemblies). I set the WorkingDirectory for the unit tests and then set the OutputXmlFile to be the name of the project with a suffix of '-results.xml'. The next step is to call the Xslt task that will process the unit test results into an HTML report. The Inputs parameter is set to the unit test results file that was generated by the NUnit task. The Xsl parameter is set to the .xsl file that will translate the results into an HTML report. The Output parameter is set to the name of the report file, TestReport.html. The final step is to set the BuildGroup property back to 'Build'.
With the UnitTest target complete, the Build target then calls the DeployBuild target. The overall job of this target is to archive the compiled application in a zip file, deploy the application to the deployment folder, generate and deploy NDoc documentation, check-in the version file that was used by the AssemblyInfo target and clean up the build server folders. Here is the target:
313 <Target Name="DeployBuild" Condition="'$(BuildGroup)' == 'Build'">
314 <!-- Compiled web files -->
315 <CreateItem Include="$(SourcePath)\Web.UI\**\*.*">
316 <Output TaskParameter="Include" ItemName="CompiledWebFiles" />
319 <!-- Copy compiled web project to build folder -->
320 <Copy SourceFiles="@(CompiledWebFiles)" DestinationFiles="@(CompiledWebFiles->'$(BuildPath)\%(RecursiveDir)%(Filename)%(Extension)')" />
322 <!-- Deployment web files -->
323 <CreateItem Include="$(BuildPath)\**\*.*"
346 $(BuildPath)\**\Web References\**;
353 <Output TaskParameter="Include" ItemName="DeploymentWebFiles" />
356 <!-- Archive build -->
357 <Zip Files="@(DeploymentWebFiles)" ZipFileName="$(BuildArchiveFolder)\$(ProjectNamespace)_$(Major).$(Minor).$(Build).$(Revision).zip" />
359 <!-- Check to make sure web site directory exists, create if necessary, and clean contents -->
360 <RemoveDir Condition="Exists('$(DeploymentFolder)')" Directories="$(DeploymentFolder)" />
362 <!-- Copy web site -->
363 <Copy SourceFiles="@(DeploymentWebFiles)" DestinationFiles="@(DeploymentWebFiles->'$(DeploymentFolder)\%(RecursiveDir)%(Filename)%(Extension)')" />
365 <!-- Generate and deploy documentation -->
366 <!--<CallTarget Targets="Documentation" />-->
368 <!-- Checkin BuildNumber.txt -->
369 <VssCheckin UserName="$(VssUsername)"
375 Comment="CC.NET auto-incrementing revision number for build." />
377 <!-- Clean the source folders -->
378 <RemoveDir Directories="@(CleanSource)" />
379 <Exec Command="del /F /Q $(SourcePath)\*.*" />
The first thing I do is create an item group that contains all the files in the web project folder. I label this item group CompiledWebFiles since the project has been compiled. I then copy that item group to the BuildPath folder for packaging and archiving. Before I package the web project files into a zip file and archive the files I create another item group that contains all the files in the BuildPath minus the file types that I declare with the Exclude parameter. This assures me that I will not deploy any of those file types to the deployment folder or include them in the zip file for archiving. I then create the zip file with the Zip task and name the zip file according to the ProjectNamespace and the version number calculated in the CheckoutVersionFile target. The next step is to ensure the deployment folder exists and is clean. I do this with the RemoveDir task. I then deploy the web project to the clean deployment folder with the Copy task.
The next step is to generate the documentation with NDoc. In order for me to get the documentation generation to work with .NET 2.0 I'm using a very early alpha version of NDoc2. The creator of NDoc is currently working on the next version but has no timeframe for when it should be released. He was generous enough to allow me to fiddle with an early alpha. If you would like to get a copy of the alpha version you can email Kevin Downs and request a copy. I can't guarantee that he will give everyone a copy, but it's worth a try. He's been very busy with other things which explains the slow progression of NDoc2. You can also monitor the status of NDoc2 on the mailing list. If you can't get a copy of the alpha version, simply comment out this section so that you can proceed to get the build running, or better yet, post on the email list that you need NDoc2! I'm going to omit adding documentation generation for this article simply because NDoc2 is in such an early phase of development.
I then check-in the version file with the updated version back into VSS. The final task is to clean the source folders.
Verifying the Results
To confirm that the build was successful, you can use either CC.NET's web dashboard or CCTray. I prefer to use CCTray which is a systray application that comes with CC.NET that runs on your development machine and monitors the CC.NET projects. Here is a screenshot of CCTray that I've setup to monitor the projects on the build server:
Here is a screenshot of CC.NET's web dashboard:
I also setup individual web sites for each BuildType (Dev, Stage, QA, and Prod):
The folders for these web sites reside in the Inetpub folder:
These folders coincide with the individual DeploymentFolder property set for each BuildType. For this demo, I'm deploying each different BuildType on the same server. This is obviously not a real deployment scenario. Normally, each different BuildType would be deployed to it's own separate server, with the Production server most likely offsite.
If we performed a build for the Dev BuildType and then viewed the web site, we would get the following output:
Notice how the ParseTokens target replaced the tokens in the Default.aspx page with the appropriate values.
As you can see from this example, customizing MSBuild for CC.NET produces tremendous power and flexibility. In this example, we have created a fully automated build process that we can use for our application from development all the way to production. I covered the most common operations of a build process but left out some operations such as running FXCop or database integration. Hopefully I have sparked your imagination about using MSBuild and CC.NET to create customized solutions for continuous integration.
You can download the Visual Studio solution and a copy of the CC.NET configuration file here. The solution is not under source control. You will need to mimic the VSS setup I used in this article to run the build script.