未知标识符(inno设置)

时间:2015-02-19 09:30:36

标签: inno-setup

嘿嘿伙计们,我试图用dotnet检查器制作一个安装程序(如果.net4没有安装它必须安装它)但是我不能让它工作因为某些原因..

Any1可以提供帮助吗?对inno设置有点新鲜

我在第56行收到错误(未知标识符'IsDotNetDetected')

function CheckIsDotNetDetected(): boolean;
begin
    result := IsDotNetDetected('v4\Client', 0); <----- error
end;

(完整代码(第54行的错误))http://pastebin.com/aD8JX325

谢谢:D

1 个答案:

答案 0 :(得分:0)

要检查安装期间是否安装了.NET框架,请将以下代码部分添加到安装脚本中:

; Check if dot net is insalled
[Code]
function FrameworkIsNotInstalled: Boolean;
begin
  Result := not RegKeyExists(HKEY_LOCAL_MACHINE, 'Software\Microsoft\.NETFramework\policy\v4.0');
end;

// Install dot net with feedback
[Code]
procedure InstallFramework;
var
  StatusText: string;
  ResultCode: Integer;
begin
  StatusText := WizardForm.StatusLabel.Caption;
  WizardForm.StatusLabel.Caption := 'Installing .NET framework...';
  WizardForm.ProgressGauge.Style := npbstMarquee;
  try
    if not Exec(ExpandConstant('{tmp}\dotNetFx40_Full_x86_x64.exe'), '/q /noreboot', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
    begin
      // you can interact with the user that the installation failed
      MsgBox('.NET installation failed with code: ' + IntToStr(ResultCode) + '.',
        mbError, MB_OK);
    end;
  finally
    WizardForm.StatusLabel.Caption := StatusText;
    WizardForm.ProgressGauge.Style := npbstNormal;
  end;
end;

在files部分中添加.NET安装程序文件。请注意标记AfterInstallCheck将调用函数来检查是否已安装.NET并在需要时安装。

Source: "C:\Example\dotNetFx40_Full_x86_x64.exe"; DestDir: {tmp}; Flags: deleteafterinstall; AfterInstall: InstallFramework; Check: FrameworkIsNotInstalled