tags:

views:

46

answers:

2

How am I supposed to upgrade my WPF applications to the Framework 4? Every time I try to change the target framework to version 4, it keeps telling me that WindowsBase, PresentationCore and PresentationFramework aren't in the targeted framework.

This seems to preclude me from using .NET 4, so clearly I'm missing something major here.

Here are the steps I'm taking

1) Open VS2008 solution using VS2010. 2) Let it do the upgrade for me. 3) Attempt to change the target framework of the WPF project to .Net 4 Client Profile. 4) Error message pops up

+4  A: 

You may have to remove and re-add the references to those assemblies in Visual Studio. When you add the references, make sure that you are pulling them from the GAC and not using file references.

The problem might be that you are referencing the old versions explicitly and you have to re-add the reference to retarget it to the new framework version. I would expect Visual Studio would do this for you automatically, but you may have to do it manually.

Garo Yeriazarian
+1 I had this problem when I upgraded a project to work with Visual Studio 2010. It didn't update the WPF references to use .Net 4 and was still referencing the older versions instead.
rossisdead
I have had this same issue, with a WPF project no less. Garo's solution worked fine for me.
Scott Chamberlain
+1: .Net 4 did some slight refactoring of the assemblies that certain classes are contained in also, so the references may need some updating as a result regardless.
Greg D
When I try to remove and re-add the references, it says that it's filtering for .Net Framework 3.5. I'm guessing that's because I was originally targeting 3.5, hence I can't add the references to the new framework
Jonathan Beerhalter
And if I browse and add them, I still get the same error message
Jonathan Beerhalter
Don't use the "Browse" to add the references, you should use the ".NET" tab to add the references.You could even try wiping out all your references, saving the project, closing the solution, reopen the solution, then re-adding the references. Also, double check the "Reference Paths" in the project properties, make sure there are no paths set up that are pointing directly to v3.5 assemblies, this could override your reference path.
Garo Yeriazarian
A: 

Turns out this is an issue with my machine, as other machines in our office can upgrade the project no problem.

Jonathan Beerhalter