views:

315

answers:

2

I have different projects written in .NET 3.5 and some unit test projects to cover them. When converting my solution to be used in Visual Studio 2010 I keep all my projects in 3.5 but the unit tests are forced to 4.0? This way I cannot use them with my regular projects anymore.

Resulting in this: Could not load file or assembly 'xxx.xxx.Core.UnitTest' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

So I can't unit test any project less then 4.0? Or am I doing something wrong here?

+2  A: 

Currently the sad answer is yes - only tests created with VS2010 (.NET 4.0) are supported.

Apparently this one done on purpose - take a look at this "bug" report at Microsoft connect for details.

Dror Helper
That is grim if it's true. But as this in in regard to MSTest, so it's no that much of a big deal after all.
Finglas
+1  A: 

While test projects get converted to Visual Studio 2010 Test Project and compiled targeted for the .NET 4.0 framework luckily all the assemblies that you reference and test in your tests can still be .NET 3.5 (or whatever) assemblies. Anything else would be disastrous. But yes, you can no longer use Visual Studio 2008 to run those test projects.

A workaround, of course, would be to keep the source code for the tests, but have two different test projects, one for VS2008, and one for VS2010 using that same test source code. Cumbersome, but a working solution.

Yngvar