To run this application, you first must install .Net 4.5

你说的曾经没有我的故事 提交于 2020-01-03 07:29:10

问题


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?


回答1:


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)




回答2:


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.




回答3:


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?




回答4:


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



来源:https://stackoverflow.com/questions/14745787/to-run-this-application-you-first-must-install-net-4-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!