2017-09-05 33 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

我的回答對你有幫助嗎? –

相關問題