So I got around to adding Database rollback functionality to my MSTest unit tests by using an article I read in MSDN magazine back in 04, before switching to MBUnit at my last job.
Everything was working great on my local computer (Vista even), and then I checked in my tests, and the failed, horribly on the build server. Fist issue was MSDTC network access was not enable, so I fixed that, but Then the build wouldn't even complete.
I dropped down to a console window and ran the tests manually using the MSTest command line tool. When running all of the tests, it hung after about test #9 of 17. When running the tests individually I was getting MSDTC errors. After spending too long just randomly trying DTC settings, I rememberd the trusty MSDTC testing tool I had stashed away for problems like this. Got that copied over to the build server and.....a generic error message that had me searching on google to no avail.
Around this time, I noticed that the event view was conviently located in the same MMC windows as Component Services, and had ment to check it for the past 30 minutes, I finally opened it up and BAM, there it was, a DTC error, but would it give me a clue as to what the problem was? YES! Not only a clue, but a god dam solution to boot (a welcome change).
The problem? My build server was from the same clone as my Dev Server that had the SQL DB on, and since I did not use sysprep, but SysInternals NewSid app, the DTC was not setup correctly (they both had the same ID).
The solution? Run msdtc -uninstall and then msdtc -install from the command line to reinstall msdtc. I had to run msdtc -install twice and click around in the Component Services windows a couple of times before i could get DTC configured for using a local cooridantor, but in the end, it was running.
Back to dtctester, which passed, back to my command line unit tests, which passed, back to the build server, which passed.
Now because I like the extra challenge, I thought I'd enable windows firewall on the build server as well. Whooops, broke it again, but I knew I had gotten DTC to work before so it was just a matter of comparing settings.
It's pretty easy to get DTC to work with windows firewall, just enable an exception in the firewall for c:\windows\system32\msdtc.exe, and don't forget to restart MSDTC service for changes to really take affect.
Bam, everything works, and now, I can go home.
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.