Deployment 应为inno安装程序标识符

Deployment 应为inno安装程序标识符,deployment,dependencies,inno-setup,Deployment,Dependencies,Inno Setup,所以我在Inno安装脚本IDE中得到了一个标识符预期错误,我想知道如何修复它。这与安装程序所需的依赖项(如果该依赖项不存在)有关。代码如下: [code] function FrameworkIsNotInstalled: Boolean; begin Result := not RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\.NETFramework\policy\v4.0'); end; procedure InstallFr

所以我在Inno安装脚本IDE中得到了一个标识符预期错误,我想知道如何修复它。这与安装程序所需的依赖项(如果该依赖项不存在)有关。代码如下:

[code]
function FrameworkIsNotInstalled: Boolean; 
begin
  Result := not RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\.NETFramework\policy\v4.0');
end;
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'), '/p /noreboot', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
    begin
       MsgBox('.NET installation failed with code: ' + IntToStr(ResultCode) + '.',
         mbError, MB_OK);
    end;
  finally
    WizardForm.StatusLabel.Caption := StatusText;
    WizardForm.ProgressGauge.Style := npbstNormal;
  end;
function isADBinstalled: Boolean; //error occurs on this line
begin
  Result := not DirExists(ExpandConstant '{sd}\adb');
procedure installadb
var
StatusText: string;
begin
StatusText := WizardForm.StatusLabel.Caption;
WizardForm.StatusLabel.Caption := 'Installing ADB this shouldnt be long...';
WizardForm.ProgressGauge.Style := npbstMarquee;
  try
    if not Exec(ExpandConstant('{tmp}\adb-setup-1.4.2.exe'), '/p /noreboot', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
    begin
       MsgBox('ADB Install failed with code: ' + IntToStr(ResultCode) + '.',
         mbError, MB_OK);
    end;
  finally
    WizardForm.StatusLabel.Caption := StatusText;
    WizardForm.ProgressGauge.Style := npbstNormal; 
end;

end;
你有好几次忘记了结束关键字

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

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'), '/p /noreboot', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
    begin
      MsgBox('.NET installation failed with code: ' + IntToStr(ResultCode) + '.',
        mbError, MB_OK);
    end;
  finally
    WizardForm.StatusLabel.Caption := StatusText;
    WizardForm.ProgressGauge.Style := npbstNormal;
  end;
end; // you forgot this

function isADBinstalled: Boolean; //error occurs on this line
begin
  Result := not DirExists(ExpandConstant '{sd}\adb');
end; // you forgot this  

procedure installadb; // you forgot the semicolon
var
  StatusText: string;
begin
  StatusText := WizardForm.StatusLabel.Caption;
  WizardForm.StatusLabel.Caption := 'Installing ADB this shouldnt be long...';
  WizardForm.ProgressGauge.Style := npbstMarquee;
  try
    if not Exec(ExpandConstant('{tmp}\adb-setup-1.4.2.exe'), '/p /noreboot', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
    begin
      MsgBox('ADB Install failed with code: ' + IntToStr(ResultCode) + '.',
        mbError, MB_OK);
    end;
  finally
    WizardForm.StatusLabel.Caption := StatusText;
    WizardForm.ProgressGauge.Style := npbstNormal; 
  end; // you forgot this 
end;    
通过正确格式化代码,可以避免这些错误。每次键入“开始”时,都应直接键入相应的“结束”。对方括号和引号执行相同的操作

您有好几次忘记了结束关键字

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

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'), '/p /noreboot', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
    begin
      MsgBox('.NET installation failed with code: ' + IntToStr(ResultCode) + '.',
        mbError, MB_OK);
    end;
  finally
    WizardForm.StatusLabel.Caption := StatusText;
    WizardForm.ProgressGauge.Style := npbstNormal;
  end;
end; // you forgot this

function isADBinstalled: Boolean; //error occurs on this line
begin
  Result := not DirExists(ExpandConstant '{sd}\adb');
end; // you forgot this  

procedure installadb; // you forgot the semicolon
var
  StatusText: string;
begin
  StatusText := WizardForm.StatusLabel.Caption;
  WizardForm.StatusLabel.Caption := 'Installing ADB this shouldnt be long...';
  WizardForm.ProgressGauge.Style := npbstMarquee;
  try
    if not Exec(ExpandConstant('{tmp}\adb-setup-1.4.2.exe'), '/p /noreboot', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
    begin
      MsgBox('ADB Install failed with code: ' + IntToStr(ResultCode) + '.',
        mbError, MB_OK);
    end;
  finally
    WizardForm.StatusLabel.Caption := StatusText;
    WizardForm.ProgressGauge.Style := npbstNormal; 
  end; // you forgot this 
end;    

通过正确格式化代码,可以避免这些错误。每次键入“开始”时,都应直接键入相应的“结束”。对方括号和引号执行相同的操作

我设法使用了下面的答案,并对其进行了一些调整,以修复无效的数字或参数消息:

Source: "C:\Users\James\Downloads\DotNet Framework 4.5.1.exe"; DestDir: {tmp}; Check: FrameworkIsNotInstalled;
Source: "C:\Users\James\Downloads\adb-setup-1.4.2.exe"; DestDir: {tmp} ; Check: ADBNotInstalled;
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[code]
//check if .net 4.5 installed
function FrameworkIsNotInstalled: Boolean;
begin
    Result := not RegKeyExists(HKEY_LOCAL_MACHINE, 'Software\Microsoft\.NETFramework\policy\v4.0\Release');
end;
//install .net
procedure InstallFramework;
var
  StatusText: string;
  ResultCode: Integer;
begin
  StatusText := WizardForm.StatusLabel.Caption;
  WizardForm.StatusLabel.Caption := 'Installing .NET framework This may take a while...';
  WizardForm.ProgressGauge.Style := npbstMarquee;
  try
    if not Exec(ExpandConstant('{tmp}\dotNetFx40_Full_x86_x64.exe'), '/p /noreboot', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
    begin
      MsgBox('.NET installation failed with code: ' + IntToStr(ResultCode) + '.',
        mbError, MB_OK);
    end;
  finally
    WizardForm.StatusLabel.Caption := StatusText;
    WizardForm.ProgressGauge.Style := npbstNormal;
  end;
 end;
//check if adb is installed check is with setup installer
function ADBNotInstalled: Boolean;
begin
  Result := not DirExists(ExpandConstant('{sd}\adb'));
end;
procedure InstallADB;
var
  StatusText: string;
  ResultCode: Integer;
begin
  StatusText := WizardForm.StatusLabel.Caption;
  WizardForm.StatusLabel.Caption := 'Installing ADB this will be just a second...';
  WizardForm.ProgressGauge.Style := npbstMarquee;
  try
    if not Exec(ExpandConstant('{tmp}\adb-setup-1.4.2.exe'), '/q /noreboot', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
    begin
      MsgBox('ADB Failed to install with code: ' + IntToStr(ResultCode) + '.',
        mbError, MB_OK);
    end;
  finally
    WizardForm.StatusLabel.Caption := StatusText;
    WizardForm.ProgressGauge.Style := npbstNormal;
  end;
 end;

我设法使用了下面的答案,并对其进行了一些调整,以修复无效的数字或参数消息:

Source: "C:\Users\James\Downloads\DotNet Framework 4.5.1.exe"; DestDir: {tmp}; Check: FrameworkIsNotInstalled;
Source: "C:\Users\James\Downloads\adb-setup-1.4.2.exe"; DestDir: {tmp} ; Check: ADBNotInstalled;
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[code]
//check if .net 4.5 installed
function FrameworkIsNotInstalled: Boolean;
begin
    Result := not RegKeyExists(HKEY_LOCAL_MACHINE, 'Software\Microsoft\.NETFramework\policy\v4.0\Release');
end;
//install .net
procedure InstallFramework;
var
  StatusText: string;
  ResultCode: Integer;
begin
  StatusText := WizardForm.StatusLabel.Caption;
  WizardForm.StatusLabel.Caption := 'Installing .NET framework This may take a while...';
  WizardForm.ProgressGauge.Style := npbstMarquee;
  try
    if not Exec(ExpandConstant('{tmp}\dotNetFx40_Full_x86_x64.exe'), '/p /noreboot', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
    begin
      MsgBox('.NET installation failed with code: ' + IntToStr(ResultCode) + '.',
        mbError, MB_OK);
    end;
  finally
    WizardForm.StatusLabel.Caption := StatusText;
    WizardForm.ProgressGauge.Style := npbstNormal;
  end;
 end;
//check if adb is installed check is with setup installer
function ADBNotInstalled: Boolean;
begin
  Result := not DirExists(ExpandConstant('{sd}\adb'));
end;
procedure InstallADB;
var
  StatusText: string;
  ResultCode: Integer;
begin
  StatusText := WizardForm.StatusLabel.Caption;
  WizardForm.StatusLabel.Caption := 'Installing ADB this will be just a second...';
  WizardForm.ProgressGauge.Style := npbstMarquee;
  try
    if not Exec(ExpandConstant('{tmp}\adb-setup-1.4.2.exe'), '/q /noreboot', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
    begin
      MsgBox('ADB Failed to install with code: ' + IntToStr(ResultCode) + '.',
        mbError, MB_OK);
    end;
  finally
    WizardForm.StatusLabel.Caption := StatusText;
    WizardForm.ProgressGauge.Style := npbstNormal;
  end;
 end;

正确地格式化你的代码,你会发现什么是错误的-我是inno的新手,经验不足4小时。我想这很明显,这更多的是关于代码的意义,而不是编程。你可以将它应用到任何编程语言中,不管它是使用大括号还是开始..结束块。这看起来像是一次快速复制粘贴尝试。正确设置代码格式,您将发现错误-我是inno的新手,经验不足4小时。我想这很明显,这更多的是关于代码的意义,而不是编程。你可以将它应用到任何编程语言中,不管它是使用大括号还是开始..结束块。这看起来像是一些快速复制粘贴尝试。现在我得到了无效的参数数错误,它在我正在检查的路径行上…现在我得到了无效的参数数错误,它在我正在检查的路径行上。。。