.Net Development Trees part II

.Net Development Trees part II

by blamoreaux 15. August 2007 09:05
I've found that taking thought in setting up your project development tree can really help with unit testing and having continuous integration for you projects. This is the second installment of a presentation I put on during Desert Code Camp.

Tools

The following tools were used during the presentation and I'll go over how each one can be used with a sample project.
  • NAnt
  • NAntContrib
  • NUnit
  • NCover
  • WatiN
  • SVN
  • TortoiseSvn
  • CruiseControl.Net
  • TreeSurgon

Sample Project

Using Visual Studio 2005, I created a solution called Castor with several projects in it. The entire solution is in the nice development tree structure under the /castor/src/ folder. Here is what the solution looks like.

First Step: Build

Once you have a solution set up you might look at the list of tools and get lost on where to start. The easiest place to begin is to set up your project to auto-build. This is simple to do with NAnt. We will create a file called Castor.build and place it in the root of the project tree structure /castor/. Here is the first pass to get the project to build.

<?xml version="1.0" ?>

<project name="Castor" default="compile" xmlns="http://nant.sf.net/schemas/nant.xsd">

 

  <!-- Private Properties -->

   <property name="build.dir" value="build" />

 

   <!-- User Targets -->  

   <target name="clean" description="Delete Automated Build artifacts">

      <delete dir="${build.dir}" if="${directory::exists(build.dir)}"/>

   </target>  

 

   <target name="compile" description="Compiles using the AutomatedDebug Configuration">

      <msbuild project="src\Castor.sln">

         <property name="Configuration" value="AutomatedDebug"/>

      </msbuild>     

   </target>  

 

</project>


What I did was set up a special build configuration on the castro project called AutomatedDebug. This build type will compile to project just like Debug but will output the files not to the /bin folder but to the ../build folder. Then castro.build just kicks off this custom build type using the NAntContrib <msbuild/> task.

Build Type

Setting up the AutomatedDebug configuration is pretty easy to do in Visual Studio 2005. Just click on Build -> Configuration Manager.

Go.bat

The last thing to do in order to get the project to build with a single click is create a batch file called go.bat and save it in the same location as the build file. The file has a single line

    1 @tools\nant\NAnt.exe -buildfile:Castor.build %*

And with that, we can open up a prompt at our project root and type go. We should get something like the following with a nice little 'Build Successful' at the end.

That does it for this installment. Next I'll dig into adding value to our build script by including auto unit testing.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Related posts

Add comment


(Will show your Gravatar icon)  

  Country flag




Live preview

January 5. 2009 22:26

Gravatar

Powered by BlogEngine.NET 1.1.0.7
Theme by Mads Kristensen

Subscribe

About the author

Brig Lamoraeux Brig Lamoreaux
I'm a .Net developer.

E-mail me Send mail

Calendar

<<  January 2009  >>
MoTuWeThFrSaSu
2930311234
567891011
12131415161718
19202122232425
2627282930311
2345678

View posts in large calendar

Pages

Recent posts

Recent comments

Tags

Categories


Archive

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2006-2009

Sign in