There s a bug/feature in Visual Studio 2010 where you can t create a unit test project with the 2.0 CLR.
This causes all sorts of problems when the project being tested is targetting the 2.0 CLR (ASP.NET MVC 2 on top of .Net 3.5 SP1 in this case) - crashes on debug, tests failing unexpectedly, in one case the test project doesn t even build because of the dependency on System.Web 2.0.0.0 which isn t available in projects targetting 4.0.
It s not possible to change the test project to target the 3.5 framework.
Does anyone know of a workaround?
Workarounds I m aware of, but want to avoid, include:-
1) Upgrading the whole solution to target .NET 4
I want to host on Azure and it isn t clear at this point if/when support for .NET 4.0 will be added. See .NET 4.0 on Windows Azure?
2) Rolling the whole project back to Visual Studio 2008
This is a last resort as there are a number of features in 2010 that I really want to use
3) Building the unit tests in 2008 and managing the references manually
This will work, but it ll be a tremendous pain.
Any ideas?