代码之家  ›  专栏  ›  技术社区  ›  Андрей Ка

WIX运行第二个应用程序,然后运行第一个应用程序

  •  0
  • Андрей Ка  · 技术社区  · 7 年前

    我遇到了wix安装程序的问题。我的想法是创造。msi安装程序,然后用户安装。msi,安装程序。exe运行,然后用户关闭此安装程序。exe(安装程序将安装microsoft加载项)第二个加载项(图片)将依次打开。现在,下面的代码在复选框同时选中两个应用程序后运行。运行图片的方式是否只有在第一个关闭时?请建议!这是我的代码:

    <?xml version="1.0" encoding="UTF-8"?>
    <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
      <Product Id="*" UpgradeCode="b288bcab-ad20-47d5-8d2c-1111111111" Version="$(var.ProductVersion)" Language="1033" Name="Program" Manufacturer="Program LTD">
        <Package InstallerVersion="300" Compressed="yes"/>
        <Media Id="1" Cabinet="myapplication.cab" EmbedCab="yes" />
    
        <Property Id="ALLUSERS" Value="2" /> 
        <Property Id="MSIINSTALLPERUSER" Value="1" />
    
        <!-- Step 1: Define the directory structure -->
        <Directory Id="TARGETDIR" Name="SourceDir">
          <Directory Id="ProgramFilesFolder">
            <Directory Id="InstallFiles" Name="Launch Program">
            </Directory>
          </Directory>
        </Directory>
    
    <UI>
      <UIRef Id="WixUI_Mondo" />
    
      <!-- set property and launch the first exe -->
      <Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="PrepareLaunchApplication1">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
      <Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication1">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
    
      <!-- set property and launch the second exe -->
      <Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="PrepareLaunchApplication2">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
      <Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication2">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
    </UI>
    <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Program" />
    
    <CustomAction Id="PrepareLaunchApplication1" Property="WixShellExecTarget" Value="[#Setup.exe]" />
    <CustomAction Id="LaunchApplication1"
        BinaryKey="WixCA"
        DllEntry="WixShellExec"
        Impersonate="yes" 
        Return="check"
        Execute="immediate"/>
    
    <CustomAction Id="PrepareLaunchApplication2" Property="WixShellExecTarget" Value="[#picture.png]" />  
    <CustomAction Id="LaunchApplication2" 
        BinaryKey="WixCA" 
        DllEntry="WixShellExec"
        Impersonate="no"
       />
    
        <!-- Step 2: Add files to your installer package -->
        <DirectoryRef Id="InstallFiles">
          <Component Id="Setup.exe">
            <File Id="Setup.exe" KeyPath="yes"
                  Name="Setup.exe" Source="$(var.AddinFiles)"></File>
          </Component>
     <Component Id="picture.png">
            <File Id="picture.png" KeyPath="yes"
                  Name="picture.png" Source="$(var.AddinFiles)"></File>
          </Component>  
        </DirectoryRef>
    
    
        <!-- Step 3: Tell WiX to install the files -->
        <Feature Id="MainApplication" Title="Main Application" Level="1">
    
          <ComponentRef Id="Setup.exe" />
          <ComponentRef Id="picture.png" />
        </Feature>
      </Product>
    </Wix>
    
    1 回复  |  直到 6 年前
        1
  •  3
  •   Stein Åsmul    7 年前

    使用自定义操作启动安装是一种非常不明智的做法。这很可能只会给您带来问题,而且这不是一个好的设计。

    按顺序运行安装程序是 WiX的引导程序功能 Burn 用于-允许您按指定顺序运行MSI文件和EXE文件。

    我相信您可以在这里找到Burn工作原理的工作示例: https://github.com/frederiksen/Classic-WiX-Burn-Theme . 本质上,它是一种不同类型的WiX源文件,具有自己的模式,用于引导程序创建。