2017-09-05 36 views
0

我安装了dotnet framework 3.5作为先决条件,下面是我的代码。 当我运行此代码时,出现以下错误。有人可以让我知道为什么“tmp”文件夹不能识别文件。 编辑 我已经使用“AfterInstall”而不是“BeforeInstall”,如本示例代码中所述,它工作正常。安装框架作为inno安装程序的先决条件时,在tmp文件夹中找不到文件错误

Error

当我评价我找到的路径如下常数。

Path

[Files] 
Source: "dotnetfx35setup.exe"; DestDir: {tmp}; Flags: deleteafterinstall; BeforeInstall: Install35Framework; Check: Framework35IsNotInstalled 

[Code] 
function Framework35IsNotInstalled: Boolean; 
begin 
if IsDotNetDetected('v3.5' , 1) then 
    begin 
     Result := False; 
    end else begin 
    Result := True; 
    end; 
end; 

procedure Install35Framework; 
var 
    StatusText: string; 
    ResultCode: Integer; 
begin 
    StatusText := WizardForm.StatusLabel.Caption; 
    WizardForm.StatusLabel.Caption := 'Installing .NET framework 3.5...'; 
    WizardForm.ProgressGauge.Style := npbstMarquee; 
    try 
    if not Exec(ExpandConstant('{tmp}\dotnetfx35setup.exe'), '/q /norestart', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then 
     begin 
      { you can interact with the user that the installation failed } 
      MsgBox('.NET framework 3.5 installation failed with code: ' + SysErrorMessage(ResultCode) + '.',mbError, MB_OK); 
     end; 
    finally 
    WizardForm.StatusLabel.Caption := StatusText; 
    WizardForm.ProgressGauge.Style := npbstNormal; 
    end; 
end; 

回答

0

您正在尝试安装前运行安装程序

BeforeInstall: Install35Framework 

使用AfterInstall代替。

+0

我的回答对你有帮助吗? –

相关问题