如何安装.NET Framework它尚未安装,只有当? [英] How to install .NET Framework only when it's not already installed?

查看:177
本文介绍了如何安装.NET Framework它尚未安装,只有当?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法来检查.NET Framework 4中已安装并安装它,只有当它不是系统?

Is there a way to check if the .NET Framework 4 has been installed and install it only when it's not in the system ?

我知道,如何确定,如果.NET Framework 4的是通过检查以下注册表项安装:

I know, how to determine, if the .NET Framework 4 is installed by checking the following registry key:

hasDotnet4 := RegKeyExists(HKEY_LOCAL_MACHINE, 
  'SOFTWARE\Microsoft\.NETFramework\policy\v4.0');

如何基于上述检查我有条件地运行在.NET Framework 4的安装?

How do I conditionally run the .NET Framework 4 installation based on the above check ?

推荐答案

你可以做最简单的,就是用 检查 的参数,它可以让你控制,如果从 [文件] 部分将被提取,或者如果从一定程序 [运行] 部分将被执行。下面的脚本code显示了它的用法的条件安装.NET Framework 4的:

The easiest you can do, is to use the Check parameter, which allows you to control if a certain file from the [Files] section will be extracted, or if a certain program from the [Run] section will be executed. The following script code shows its usage for the conditional installation of the .NET Framework 4:

[Files]
Source: "dotNetFx40_Full_setup.exe"; DestDir: {tmp}; Flags: deleteafterinstall; Check: FrameworkIsNotInstalled

[Run]
Filename: "{tmp}\dotNetFx40_Full_setup.exe"; Check: FrameworkIsNotInstalled

[code]
function FrameworkIsNotInstalled: Boolean;
begin
  Result := not RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\.NETFramework\policy\v4.0');
end;

这篇关于如何安装.NET Framework它尚未安装,只有当?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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