April 06, 2004

Test-Driven Development in Microsoft .Net

Been looking a lot into test driven development lately, especially the idea of integrating NUnit into our development process. There seems to be a great book on it entitled Test-Driven Development in Microsoft .Net which I will have to get once I finish reading Gary's book on Exploiting software: How to break code.

Before I get to trying some stuff with NUnit I really need to get our build system redone. Recently I saw an interesting post from Scott Hanselman about his integration of Nant, NUnit and CruiseControl. This is something I have been wrestling with for some time.

I have yet to find a good build system for my stuff. Right now I have a pretty frail set of perl scripts that does the following:

  1. Check out code from SVN
  2. Builds my kernel mode drivers via DDK (for W2K, WXP and W2K3 in three separate builds)
  3. Runs prefast on my kernel code
  4. Builds my .NET DLLs
  5. Builds my C# Winforms apps
  6. Runs FxCop (Fxcopcmd is your friend)
  7. Runs DotNetfuscator (Community edition... which sucks)
  8. Copies all files to an output directory
  9. Run Wise MSI install builder (cmdline, yet still pops up a GUI progress bar, *sigh*)
  10. Copy MSI to CD build directory
  11. Create ISO (still haven't found a good cmd line ISO builder that is free... currently must use mkisofs through cygwin)
Sounds simple enough... except that there are like 4 different perl scripts there that don't play nice together. And the whole thing requires a person at the console during the build (mostly because DotNetfuscator sucks in its requirements to run). I don't have a single automated build environment to properly know not to build the .NET side if the DDK side pukes. I know I can tweak the perl scripts better to make it more intelligent, but quite frankly I would rather find a better way to do it. And this breaks my cardinal rule to always be in a shippable state with the execution of one command. And right now daily builds are right out. (Which really annoys me)

Right now I am trying to see if there is any way I could hack together a solution to somehow do DDK builds executed from Nant. Not even sure thats possible, but its worth investigating.

Anyone else out there dealing with this challenge? How the heck can you get DDK code and .NET code to build in the same environment.

The next couple of days I think I might at the very least see if I can merge all the .NET stuff into a single Nant build script. I will need to figure some way of dropping DotNetfuscator and finding a cmdline obfuscator which doesn't require visual studio to be running. Will let you know how it goes.

Posted by SilverStr at April 6, 2004 08:58 AM | TrackBack
Comments

I haven't tried using nant to build DDK stuff before, but you can certanly do the following (in increasing order of complexity and power):

* Use the task to execute shell commands.
* Use the task to embed .NET code in your .build file.
* Write your own task in any .NET language.

I know there are also tasks for using v.6 tools from nant to do builds, but the product I work on now is all .NET, so we have never used those. But we have builds files that , , and have a few custom tasks.

Posted by: Chris Bilson at April 6, 2004 01:04 PM

Thanks for the insight Chris. Much appreciated.

Posted by: SilverStr at April 8, 2004 07:38 AM