How to run exe inside msi?

时间:2018-09-19 08:19:31

标签: visual-studio wix

Kind time of the day! I'm working on creating an msi installer using the wix toolkit. It was required to run exe from under the msi installer. Here is my code:

<Binary Id="JDK_EXE" src="..\..\jdk\jdk-6u45-windows-i586.exe"/>

<CustomAction Id="RunJavaJDKInstall"
              BinaryKey="JDK_EXE"
              ExeCommand="" 
              Return="check"/>
<InstallExecuteSequence>
  <Custom Action ="RunJavaJDKInstall" After="InstallInitialize"></Custom>
</InstallExecuteSequence>

The question is what to write in the ExeCommand tag to run jdk-6u45-windows-i586.exe on execution?

1 个答案:

答案 0 :(得分:0)

您不能在msı项目中创建,但是可以使用wix bootstrapper项目来创建它。

<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />

   <util:RegistrySearch Root="HKLM"
                     Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
                     Value="Version"
                     Variable="Netfx4FullVersion" />
  <util:RegistrySearch Root="HKLM"
                     Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
                     Value="Version"
                     Variable="Netfx4x64FullVersion"
                     Win64="yes" />
<Chain>


    <!--   <PackageGroupRef Id="Net47"/>-->   
    <ExePackage Id="Net45" Name="Microsoft .NET Framework 4.5.1 Setup" Cache="no" Compressed="yes" PerMachine="yes" Permanent="yes" Vital="yes" InstallCommand="/q"
    SourceFile=".\prerequisites\NNDP47-KB3186497-x86-x64-AllOS-ENU.exe"
    DetectCondition="(Net4FullVersion = &quot;4.5.50938&quot;) AND (NOT VersionNT64 OR (Net4x64FullVersion = &quot;4.5.50938&quot;))"
    InstallCondition="(VersionNT >= v6.0 OR VersionNT64 >= v6.0) AND (NOT (Net4FullVersion = &quot;4.5.50938&quot; OR Net4x64FullVersion = &quot;4.5.50938&quot;))"/>

  <ExePackage Id="Netfx4Full"
              DisplayName="Microsoft .NET Framework 4.0"
              Compressed="yes"
              Cache="yes"
              PerMachine="yes"
              Permanent="yes"
              Protocol="netfx4"
              Vital="yes"
              SourceFile=".\prerequisites\NNDP47-KB3186497-x86-x64-AllOS-ENU.exe"
              InstallCommand="/passive /norestart"
              DetectCondition="(Net4FullVersion = &quot;4.5.50938&quot;) AND (NOT VersionNT64 OR (Net4x64FullVersion = &quot;4.5.50938&quot;))"
              InstallCondition="(VersionNT &lt; v6.0 OR VersionNT64 &lt; v6.0) AND (NOT (Net4FullVersion OR Net4x64FullVersion))" />
  <RollbackBoundary />
          <!--   <PackageGroupRef Id="SQLExpressCE"/> Install Application  NetVersion >= 460798-->
  <MsiPackage Id="MyApplication" SourceFile="$(var.SetupProject1.TargetPath)" DisplayInternalUI="yes" Compressed="yes" Vital="yes"/>

  </Chain>
</Bundle>