Wednesday, December 14, 2011

Re-targeting Unit Test projects

If you ever created Unit Test projects in Visual Studio 2010 prior to the release of SP1, you will probably remember that you could only create Unit Test projects that targeted .Net Framework v. 4.0 for your Unit Test projects.

Unfortunately, this caused all types of issues with assembly handling and namespace resolution since assembly references differ between .Net Framework v. 3.5 and .Net Framework v. 4.0.  It made no sense to create Unit Test projects that targeted .Net Framework v. 4.0 when your base assemblies were executing on .Net Framework v. 3.5.

Needless to say, the Microsoft Visual Studio team reverted their original decision and once again allowed creation of Unit Test projects that could target the same version of the framework as the base assemblies.

However, if you have a reasonably old Unit Test project which you are now considering for re-targeting after the application of Visual Studio 2010 SP1, you may get the error message dialog below:

As it turns out this article link actually lands you here:

Basically, it requires to make some manual changes to the devenv.exe.config file in order to support Unit Test project re-targeting.

After you make the changes and re-load Visual Studio 2010, you should now be able to re-target your Unit Test projects!

No comments:

Post a Comment