This example of how to set up Visual C# 2010 Express to run NUnit as a post-build step is taken from my utility project Joger.
First, the directory layout of the Joger project looks like this:
The highlighted nunit.framework.dll is the NUnit assembly that the test project Joger.Test must have as a reference:
In the “Post-build event command line” text box of Joger.Test, the highlighted command reads:
$(SolutionDir)External\NUnit-184.108.40.20648\bin\net-2.0\nunit.exe $(TargetPath) /run
With this setup, I can press F6 to build my solution and get NUnit to run my tests automatically after a successful build:
This, however, doesn’t work on devices that only support the .NET Compact Framework. Microsoft has a special built-in unit testing story for those with Visual Studio 2008. More on that in another post.