目标.NET 4.0,但.NET 4.5是必需的 [英] Target .NET 4.0 but .NET 4.5 is required

查看:606
本文介绍了目标.NET 4.0,但.NET 4.5是必需的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们最近搬到VS 2012,但我们必须继续使用.NET 4.0。我们的客户群很大一部分仍在使用XP和.NET 4.5不支持Windows XP。

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.

现在,在解决方案中的所有项目都瞄准.NET 4.0或更低。当我们运行的应用程序,它告诉我们,安装.NET 4.5框架,而只有在.NET 4.0中使用?

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>

如果我修改 =版本V4.5 =版本V4.0 手动在配置文件中,一切都工作正常,我们就可以运行应用程序,但它似乎不可思议不得不这样做呢?谁能给我解释一下是什么原因造成的解决方案,要求4.5,而我们开发的4.0?

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?

推荐答案

里面的app.config文件,当您使用Visual Studio 2012。当你重新定位你的项目创建的.NET Framework 4.5的项目该XML内容自动创建。 NET Framework 4中,这些项目也恢复了在app.config文件。它看起来像你的app.config项未恢复的某些原因。 这是确定的手动编辑的文件(你这样做)。您的项目将不要求.NET框架4.5了。

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.

这篇关于目标.NET 4.0,但.NET 4.5是必需的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆