Target .NET 4.0 but .NET 4.5 is required

吃可爱长大的小学妹 提交于 2019-12-23 08:27:13

问题


We recently moved to VS 2012, but we are required to keep on using .NET 4.0. A large part of our customer base is still using XP and .NET 4.5 is not supported on Windows XP.

Now, all projects in the solution are targeting .NET 4.0 or lower. When we run the application it tells us to install the .NET 4.5 Framework, while only the .NET 4.0 is used?

In the generated config file I see:

<startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>

If I change Version=v4.5 to Version=v4.0 manually in the config file, everything works fine and we can run the application, however it seems weird to have to do this? Can somebody explain to me what is causing the solution to ask for 4.5 while we develop for 4.0?


回答1:


This XML content is automatically created inside app.config file when you create .NET Framework 4.5 project using Visual Studio 2012. When you re-target your project to .NET Framework 4, these entries are also reverted in app.config file. It looks like your app.config entry was not reverted for some reason. It's OK to manually edit the file (as you have done). Your projects will not ask for .NET Framework 4.5 anymore.



来源:https://stackoverflow.com/questions/13214503/target-net-4-0-but-net-4-5-is-required

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