我正在尝试使用 Inno Setup 来准备创建安装程序。我的第一次尝试是向用户报告当前安装了哪个 .NET Framework。我想出了以下脚本,它安装了一个令牌 exe,但它没有显示我想要显示已安装的框架版本的消息框。
[Setup]
AppName=NETFramework_Test
AppVersion=1.0.0
DefaultDirName=c:\al\NetFWTest\test
WizardStyle=modern
OutputDir=c:\al\NetFWTest
[Files]
Source: "c:\al\computer\miscsmallapps\tmpdir\tmpdir.exe"; DestDir: "{app}";
[Code]
var
VersionNum: cardinal;
begin
if RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full',
'Version', VersionNum) then
begin
MsgBox('The installed .NET Framework version:' + IntToStr(VersionNum),
mbInformation, MB_OK);
end
else
begin
MsgBox('Error reading the Registry...', mbInformation, MB_OK);
end;
end.
当您已经可以使用时为什么要手动执行此操作IsDotNetInstalled https://jrsoftware.org/ishelp/index.php?topic=isxfunc_isdotnetinstalled?
例如:
[Code]
// InitializeSetup is called when the setup is starting.
function InitializeSetup(): Boolean;
begin
Result := True;
if not IsDotNetInstalled(net462, 0) then
begin
MsgBox('The required .NET Framework version 4.6.2 is not installed.',
mbError, MB_OK)
Result := False;
end;
end;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)