2016-09-13 24 views
0

我開始使用WiX,並且在定製ExitDIalog時遇到了一些麻煩。在ExitDialog中調用自定義exe

起初我想:

  • 我想創建一個設置爲我的應用

  • 設置後,我想提出兩個選擇:

    • 啓動應用程序( application.exe新安裝)

    • 啓動可選的設置(我的應用程序需要安裝一些驅動器根據用戶的拍照)

  • 可選的設置是一個.exe文件。它應該放置在setup.msi旁邊,但不要複製到我的應用程序文件夾中。

我創建的目錄:

<Fragment> 
    <Directory Id="TARGETDIR" Name="SourceDir"> 
    <Directory Id="ProgramMenuFolder"> 
     <Directory Id="ApplicationProgramsFolder" Name="$(var.compagny)"/> 
    </Directory> 
    <Directory Id="DesktopFolder" SourceName="Desktop"/> 
    <Directory Id="ProgramFilesFolder"> 
     <Directory Id="COMPAGNYFOLDER" Name="$(var.compagny)"> 
     <Directory Id="INSTALLFOLDER" Name="$(var.product)">    
      <Directory Id="fr" Name="fr"/> 
     </Directory> 
     </Directory> 
    </Directory> 
    </Directory> 
</Fragment> 

我如何引用添加到我的.exe?我所做的:

<Component Id="ProductComponent" Guid="{2C26B191-6654-4405-8E78-F8B6EFEDC9FC}" Directory="INSTALLFOLDER"> 
    <File Id="uEye64_47100_WHQLexe" Source="./Resources/uEye64_47100_WHQL.exe" KeyPath="yes" Checksum="yes" Compressed="no" Vital="no"/> 
</Component> 

uEye64_47100_WHQL.exe文件在INSTALLFOLDER複製(我不想),並設置混合與路徑[應用] /斌/釋放(不知道有)。在日誌文件有:

Failed to open the file:C:\dev\MyApplication\main\SetupProject\bin\Release\MyCompagny\MyProduct\uEye64_47100_WHQL.exe for computing its hash. Error:3

我這樣調用該.exe(這個文件需要提升權限)

<!-- Set checkbox for launch install uEye --> 
<Property Id="WIXUI_EXITDIALOGUEYECHECKBOXTEXT" Value="Launch install uEye"/> 
<CustomAction Id="SetExecUEye" FileKey="uEye64_47100_WHQLexe" ExeCommand="" Return="asyncNoWait" Impersonate="no" Execute="deferred"/> 

<UI> 
    <UIRef Id="WixUI_Custom"/>  
    <Publish Dialog="MyExitDialog" 
      Control="Finish" 
      Event="DoAction"     
      Value="SetExecUEye">WIXUI_EXITDIALOGUEYECHECKBOX = 1 and NOT Installed</Publish> 
</UI> 

我應該如何定義我uEye64_47100_WHQL.exe被稱爲安裝後卻沒有複製在INSTALLFOLDER

回答

2

如果您不想複製文件以安裝位置,只需運行它即可將其作爲二進制源代替組件。這樣,它被打包在安裝程序中,但未安裝(可能僅限於某個臨時文件夾)。

<Binary Id="uEye64_47100_WHQLexe" SourceFile="./Resources/uEye64_47100_WHQL.exe" /> 
<CustomAction Id="InstalluEye64exe" BinaryKey="uEye64_47100_WHQLexe" ExeCommand="" Execute="deferred" Return="ignore" Impersonate="no"/> 
+0

您節省了我的一天!威克斯會讓我瘋狂。刪除一個錯誤(ErrorCode 2762)和我的設置將完成。 –

+0

是否可以將二進制文件設置爲未壓縮而不重要?我的setup.msi是4ko,optionnal.exe是150Mo。聲明爲'Binary'使得我的setup.msi爲154Mo。至少我的設置必須在沒有這個文件的情況下工作(只有複選框會出錯) –