2017-09-05 6 views
0

私はdotnet framework 3.5を前提条件としてインストールしています。以下は私のコードです。 このコードを実行すると、以下のエラーが発生します。 「tmp」フォルダがファイルを認識しない理由を教えていただけますか? EDIT このサンプルコードで説明したように、 "BeforeInstall"の代わりに "AfterInstall"を使用していて、うまくいきました。ファイルがinno setupの前提条件としてフレームワークをインストールするときに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

私の答えはあなたを助けましたか? –

関連する問題