Search code examples
c#.net-3.5visual-studio-2010.net-4.0

Will Visual Studio 2010 only run 4.0 unit tests?


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?


Solution

  • 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.

    Update
    after Microsoft's has seen the error of their way they have added .NET 3.5 unit tests support in VS2010 SP1 - the full details can be found in this post.

    You can also re-target existing .NET 4.0 unit tests - How to re-target unit-tests to .Net Framework 3.5 in VS 2010 SP1