9

I have a wpf project that I created in VS2012, but am now trying to hack in VS2010.

In the csproj file I removed the 'required version' stuff. I can open the project in VS2010, I can compile it too, but if I try to run it, I get the 'needs v4.5' message.

I tried removing all the references and adding them back in again: still compiles (so all the dependencies should be on my (XP) machine).

Where else should I be looking?

Benjol
  • 63,995
  • 54
  • 186
  • 268

4 Answers4

16

Check the <supportedRuntime> element in your .config file.

If it's set to <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> then it will be looking for .NET 4.5. (And, of course, this setting isn't used at all during compilation, which is why VS won't be issuing any warnings or errors about it when you compile)

Damien_The_Unbeliever
  • 234,701
  • 27
  • 340
  • 448
1

You need to change the Target Framework set in the Project properties.

If all else fails, then just create a new solution with a WPF application project and add all the cs files and everything else from your other solution and try then.

dutzu
  • 3,883
  • 13
  • 19
  • Thanks, I already did that, but I suspect this could be a valid answer for someone else. – Benjol Feb 07 '13 at 07:31
  • @Benjol - If there are no references to a 4.5 fw assembly and the target framework is not 4.5 then maybe there is still something left in the metadata of the .csproj that tells it it is targetting .net 4.5. Try the hard way of creating the csproj from scratch. And check if the ProjectType GUID is the same for 2 WPF projects built with 2012 and 2010. Maybe that's where the difference is. – dutzu Feb 07 '13 at 07:37
0

Visual Studio 2012 has a different Runtime than 2010 and different .Net framework, whicle VS2010 uses 4.0 the VS2012 uses 4.5.

Maby this could be helpful: Can Visual Studio 2012 be installed side-by-side w/ Visual Studio 2010?

Community
  • 1
  • 1
CloudyMarble
  • 36,908
  • 70
  • 97
  • 130
0

Try changing in web.config file:

<configuration>
    <system.web>
        <compilation debug="true" strict="false" explicit="true" targetFramework="4.5" />
    </system.web>
</configuration>

For more details

coder
  • 13,002
  • 31
  • 112
  • 214