find a location for property in a new city

Tuesday 13 April 2010

Cannot change the specified .NET framework version or profile for a test project

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 ASP.NET 3.5 framework after upgrading to Visual Studio 2010.

I loaded my VS2008 solution into the new VS2010 and asked to target ASP.NET 3.5 to begin with. This worked on all project except for my one MS unit test project. The class library for my RhinoMock tests are fine.

I couldn't Google the specific error but I did get this following helpful info from Microsoft: "It's not a bug - you just can't do it" ... Thanks!

Workaround - AKA cop out

Fortunately, for me, there aren't many tests in this project and targeting ASP.NET 3.5 is only very temporary so I have excluded this test project for now and all builds fine.

So BEWARE if you are planning on upgrading to VS2010 AND currently using MS's test library AND targeting the ASP.NET 3.5 framework! Because you can't and it doesn't look like there is a fix in sight. Disappointing!

Follow britishdev on Twitter

4 comments:

  1. It seems like a last minute 'hack' to get VS 2010 out of the door. I didn't get the option to target any framework other than 4.0 for the test, which is pretty crap really as they do go on about multi-targeting.

    So the idea of upgrading to 2010 and carrying on with your .Net 2.0 projects that include tests is not doable.

    Thanks for researching it with MS and posting, saved me hours.

    ReplyDelete
  2. Yeah, filthy hack! No worries mate, glad to know this helps :)

    ReplyDelete
  3. There is a way:
    http://www.galcho.com/Blog/PermaLink.aspx?guid=3bb11214-65c7-48b7-8d1a-5eda4aa47b6b

    ReplyDelete