简体   繁体   English

安装4.5时,不会安装.NET Framework 4.0

[英].NET Framework 4.0 does not install when 4.5 is already installed

I use Visual Studio 2012 for a WPF project needing (at least) .NET Framework 4.0. 我将Visual Studio 2012用于需要(至少).NET Framework 4.0的WPF项目。 I have 4.5 already installed, but people with Windows XP cannot install the application (because 4.5 does not run on Windows XP). 我已经安装了4.5,但是使用Windows XP的人无法安装该应用程序(因为4.5不能在Windows XP上运行)。 I use ClickOnce as the deployment application. 我使用ClickOnce作为部署应用程序。

When I try to intall version 4.0, I get the error (translated from Dutch so the English version might be a bit different): 当我尝试安装4.0版本时,我收到错误(从荷兰语翻译,因此英文版本可能会有所不同):

The same or a higher version of .NET Framework 4 is already installed on this computer 此计算机上已安装相同或更高版本的.NET Framework 4

How can I fix this? 我怎样才能解决这个问题?

.NET 4.5 is an add-on to .NET 4.0 in terms of the CLR , and as such, when you install .NET 4.5, it includes 4.0. .NET 4.5就CLR而言是.NET 4.0的附加组件,因此,当您安装.NET 4.5时,它包含4.0。 There is a known issue with ClickOnce when it is generated on a machine that has .NET 4.5 installed. ClickOnce在安装了.NET 4.5的计算机上生成时存在已知问题。

Visual Studio 2012 Update 1 is supposed to fix this issue. Visual Studio 2012 Update 1应该可以解决此问题。

You can set the .NET framework version for your .NET applications inside Visual Studio. 您可以在Visual Studio中为.NET应用程序设置.NET框架版本。 When you want to publish a Windows XP compatible version, you should always select .NET 4 or lower as the target framework. 如果要发布与Windows XP兼容的版本,则应始终选择.NET 4或更低版本作为目标框架。

The .NET 4.0 Framework should be listed side by side with 4.5. .NET 4.0 Framework应与4.5并列列出。

在此输入图像描述

This is on a normally installed Windows 8 machine, Visual Studio 2012 Ultimate, without having to install any other framework or SDK. 这是在正常安装的Windows 8计算机Visual Studio 2012 Ultimate上,无需安装任何其他框架或SDK。

.NET Framework 4.5 is an in-place update and replaces .NET Framework 4. Once you install .NET Framework 4.5 there is no way to go back to .NET Framework 4. Note that major and minor versions of .NET Framework 4.5 assemblies were not changed. .NET Framework 4.5是就地更新并替换.NET Framework 4.一旦安装.NET Framework 4.5,就无法返回到.NET Framework 4.请注意,.NET Framework 4.5程序集的主要版本和次要版本是没有改变。 This means that a .NET Framework 4 app does not "see" a difference between the two and should run the same way. 这意味着.NET Framework 4应用程序不会“看到”两者之间的差异,并且应该以相同的方式运行。 Since you want apps run on Windows XP you need to target .NET Framework 4 in your project. 由于您希望在Windows XP上运行应用程序,因此您需要在项目中使用.NET Framework 4。 This will ensure that your app is not using any new APIs added in .NET Framework 4.5. 这将确保您的应用程序不使用.NET Framework 4.5中添加的任何新API。 After you do this you should be able to run your app on both .NET Framework 4 and .NET Framework 4.5. 执行此操作后,您应该能够在.NET Framework 4和.NET Framework 4.5上运行您的应用程序。 Note that even though the compatibility bar was very high (due to .NET Framework 4.5 being an in-place update) you will still find some minor differences (eg bugs that caused exceptions in .NET Framework 4 might have been fixed in .NET Framework 4.5 and exceptions are not throw anymore) and therefore you need to test your app on .NET Framework 4 machine thoroughly since running it on .NET Framework 4.5 will not reveal some issues. 请注意,即使兼容性栏非常高(由于.NET Framework 4.5是就地更新),您仍会发现一些细微差别(例如,.NET Framework 4中导致异常的错误可能已在.NET Framework中修复4.5并且不再抛出异常)因此您需要彻底测试.NET Framework 4计算机上的应用程序,因为在.NET Framework 4.5上运行它不会显示某些问题。 The reason for this is that targetting ensures that the app is not using APIs that did not exist before but cannot ensure the behavior at runtime since on the machine with .NET Framework 4.5 it will always use .NET Framework 4.5 runtime (since there is no .NET Framework 4 runtime there anymore). 这样做的原因是,目标确保应用程序不使用之前不存在的API但无法确保运行时的行为,因为在使用.NET Framework 4.5的计算机上它始终使用.NET Framework 4.5运行时(因为没有那里有.NET Framework 4运行时)。

简单,只需检查控制面板并卸载更高版本并继续安装。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 安装了Net Framework 4.5。 可以构建/定位Framework 4.0吗? - Installed Net Framework 4.5. Can build/target Framework 4.0? 安装Framework 4.5时,以.NET Framework 4为目标 - Targeting .NET Framework 4 when Framework 4.5 is installed 强制使用msbuild 4.0在.Net 4.0中编译项目,即使.Net fw也是如此。 4.5已安装 - Force to use msbuild 4.0 to compile the project in .Net 4.0 even when .Net fw. 4.5 is installed .NET Framework 4.0是否作为Visual Studio 2010安装的一部分安装? - Is .NET Framework 4.0 installed as part of Visual Studio 2010 install? .net framework 3.5是否需要安装.net framework 4.0? - Does .net framework 3.5 required to install .net framework 4.0? .NET 4.0框架中是否已经存在以下通用方法? - Does the following generic method already exist in the .NET 4.0 framework? ASP.NET 4.5 是否需要 .NET 4.5(或者 4.0 是否足够?) - Does ASP.NET 4.5 require .NET 4.5 (or is 4.0 sufficient?) 无法安装.net Framework 4.0 - Unable to install .net framework 4.0 可以成功安装.NET 4.5的构建服务器将面向4.0的项目部署到仅安装了.NET 4.0的服务器吗? - Can a build server with .NET 4.5 installed successfully deploy a project targeting 4.0 to a server with only .NET 4.0 installed? 为什么.NET 4.0程序在安装了.NET 4.5的Windows Server 2012计算机上会产生system.unauthorizedAccess错误? - Why does a .NET 4.0 program produce a system.unauthorizedAccess error on a Windows Server 2012 machine with .NET 4.5 installed?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM