I received the error message "attempted re-targeting of the project has been canceled. You cannot change the specified .NET framework version or profile for a test project" when trying to target the .NET 3.5 framework after upgrading to Visual Studio 2010.
And this was tricky – we want to move to VS 2010 but still compile against .NET .3.5. Although having tests target .NET 4 is not critical is not very nice. We don’t want to have bugs slipped out because production code and test code are compiled against different .NET versions.
Luckily there is a solution – manually editing .csproj file and trick VS2010 to think it is not a test class library but simply class library:
- Open .csproj file with notepad.
- Search for this line:
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- Remove {3AC096D0-A1C2-E12C-1390-A8335801FDAB} guid
- Save file and Open in VS 2010
- It is ready to be re-targeted
Hope this helps