Thursday, March 15, 2007

Problems adding a test project in Orcas CTP

I've been playing with the March 2007 CTP of Orcas and the associated VSTS goodness that it contains. It did something a bit funny to me the other day that wasted an hour or two of poking around when the solution ended up being simple but not obvious.
I started out with a simple class library and then went to add a test project. I'm an NUnit guy but I frequently use the unit testing in VSTS. Of course the first thing you have to do with any unit testing project is add a reference to the assembly you want to test. When I did this I got a warning telling me that the assembly that was being referenced (the class library) was being built for a newer version of the framework than the project that was referencing it (the test project). That seemed bad.
I was trying to write some unit tests around LINQ and just couldn't get the test project to compile when I added any 3.5 code to the test project. I know that in the project properties there is a way to set the target framework, but when I went to the property pages for the project there was an exception. It's a CTP so no big deal, but I really want to write some unit tests around what I'm doing.
On a lark I closed visual studio and opened it again. When I opened it the project conversion wizard popped up telling me the test project was created with an earlier version of Visual Studio. It wasn't, but this is a CTP so no real worries. Once the project conversion wizard ran all was good.
Long story short, if you are adding a test project in the ctp, close and re-open the solution and let the project conversion wizard run before you go too far.