【问题标题】:WiX: How do I get the MSI's dialogs to show, when wrapped in Burn/EXE?WiX:如何在 Burn/EXE 中显示 MSI 的对话框?
【发布时间】:2013-06-26 18:56:41
【问题描述】:

我有一个带有对话框的 MSI,提示用户 [1] 浏览到安装目录,[2] 接受 EULA,[3] 安装完成后启动应用程序。

我将 MSI 封装在 Burn Bundle 中以制作 EXE。现在我看到的只是 EXE 的 EULA 提示,但没有提示选择安装目录或启动应用程序。

我想使用EXE格式,因为客户理解它,我可以关联我的图标并将我的版本号嵌入到EXE中,它会提示输入管理员密码。客户将我的软件下载为单个可执行文件。

这是代码:

<WixVariable Id="WixStdbaLogo" Value="MyIcon.ico" />
<Variable Name="InstallFolder" Type="string" Value="[ProgramFilesFolder]MyCompany\MyProduct"/>
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<WixVariable Id="WixStdbaLicenseRtf" Value="MyLicense.rtf" />

<Chain>
    <MsiPackage
      Id="Setup"
      Compressed="yes"
      SourceFile="MyProduct.msi"
      Vital="yes"
      DisplayInternalUI="yes"
      EnableFeatureSelection="yes"
      >
        <MsiProperty Name="INSTALLLOCATION" Value="[InstallFolder]" />
    </MsiPackage>
</Chain>

"DisplayInternalUI="yes" 选项似乎没有达到我想要的效果。"EnableFeatureSelection" 无论是或否都没有区别。

如何显示 MSI 对话框?或者,如何让刻录生成的 EXE 提示安装目录和应用启动?

我使用的是 WiX 3.7.1224,VS 2010。

我查看了以下来源:

这是 MSI(添加于 6 月 30 日 13:07 AST):

<Product Id="*" Name="My Product" Language="1033" Version="5.0.0" 
     Manufacturer="My Company" UpgradeCode="0bd6d4cf-d23d-431a-9baf-c72cb0525f0c">
  <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

  <MajorUpgrade DowngradeErrorMessage="A newer version of My Program is already installed." />
  <MediaTemplate EmbedCab="yes" CompressionLevel="high"/>

  <Feature Id="ProductFeature" Title="My Product" Level="1">
    <ComponentGroupRef Id="ProductComponents" />
  </Feature>

  <!-- Set Installer's Icon in Add/Remove Programs -->
  <Icon Id="icon.ico" SourceFile="MyProduct.ico"/>
  <Property Id="ARPPRODUCTICON" Value="icon.ico" />

  <Property Id="ProductSeed"> 3022 </Property> 
  <Binary Id="PlantSeedDLL" SourceFile="..\..\PlantSeed\Release\PlantSeed.DLL" />
  <CustomAction Id="DLLPlantSeed" BinaryKey="PlantSeedDLL" DllEntry="PlantSeedFunc"
    Execute="immediate" Return="check" HideTarget="no" Impersonate="yes"/>

  <!-- Step 1: Define the directory structure -->
  <Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="ProgramFilesFolder">
      <Directory Id="INSTALLFOLDER" Name="My Product"/>
    </Directory>
    <!-- Shortcut on Start Menu -->
    <Directory Id="ProgramMenuFolder">
      <Directory Id="ApplicationProgramsFolder" Name="My Product"/>
    </Directory>
    <!-- Desktop shortcut -->
    <Directory Id="DesktopFolder" Name="Desktop">
    </Directory>
  </Directory>

  <CustomAction Id="Install_PDF_printer" FileKey="Install.exe"
    ExeCommand='Install.exe -s "My PDF Printer" -n "My Company Inc." -c "****************"'
    Execute="deferred" Return="check" HideTarget="no" Impersonate="no" />

  <!-- Banner images -->
  <!-- <WixVariable Id="MainLogoBmp" Value="Resources/Images/weblabel.jpg" /> -->
  <WixVariable Id="WixUIBannerBmp" Value="MyProduct iconWiXbanner.jpg" /> <!-- 493 × 58 -->
  <WixVariable Id="WixUIDialogBmp" Value="MyProduct 616x390.jpg" /> <!-- 616 × 390 -->

  <!-- License (not necessary to have it as a component) -->
  <WixVariable Id="WixUILicenseRtf" Value="MyProduct License.rtf" />

  <!-- Prompt for install directory -->
  <Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
  <UIRef Id="WixUI_InstallDir" />

  <!-- Display checkbox Prompt to run EXE at end -->
  <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1"/> <!-- Default to checked -->
  <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch My Product" />
  <Property Id="WixShellExecTarget" Value="[#MyProduct.exe]" />
  <CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />

  <!-- Prompt to run EXE at end -->
  <UI>
    <UIRef Id="WixUI_FeatureTree"/> <!-- causes compilation errors -->
    <Publish Dialog="ExitDialog"
      Control="Finish"
      Event="DoAction"
      Value="LaunchApplication">
      WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed
    </Publish>
  </UI>

  <UI> <!-- For the dialogs -->
    <TextStyle Id="Font10" FaceName="Tahoma" Size="10" Red="0" Green="0" Blue="0"  />
    <TextStyle Id="Font12" FaceName="Tahoma" Size="12" Red="0" Green="0" Blue="0"  />
  </UI>

  <!-- Include dialogs -->
  <Property Id="ApplicationFolderName" Value="MyProduct Folder" /> <!-- WixUI_Advanced -->
  <Property Id="WixAppFolder" Value="WixPerMachineFolder" /> <!-- WixUI_Advanced -->
  <!-- Install for all users -->
  <WixVariable Id="WixUISupportPerUser" Value="0" /> <!-- WixUI_Advanced -->

  <!-- Write product key in Registry -->
  <DirectoryRef Id="TARGETDIR">
    <Component Id="RegistryEntries" Guid="*">
    <!-- HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\My Company Inc.\My Product -->
    <RegistryKey Root="HKLM"  
           Key="Software\My Company Inc.\My Product" >
      <RegistryValue Type="string" Name="TARGET" Value="[INSTALLFOLDER]"/>
    </RegistryKey>
    </Component>
  </DirectoryRef>

    <!-- Shortcut on Start Menu -->
  <DirectoryRef Id="ApplicationProgramsFolder">
    <Component Id="ApplicationShortcut" Guid="*">
      <Shortcut Id="ApplicationStartMenuShortcut"
        Name="My Product"
        Description="My Product"
        Target="[INSTALLFOLDER]MyProduct.exe"
        WorkingDirectory="INSTALLFOLDER"
      />
      <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
      <RegistryValue Root="HKCU" Key="Software\Microsoft\My Product" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
    </Component>
  </DirectoryRef>

  <!-- Step 2: Add files to your installer package -->
  <DirectoryRef Id="INSTALLFOLDER">

    <Component Id="MyProduct.exe" Guid="*">
      <File Id="MyProduct.exe" Name="MyProduct.exe"
        Source="..\\..\\Release\\MyProduct.exe"
        KeyPath="yes" Checksum="yes">

        <!-- Desktop shortcut -->
        <Shortcut Advertise="yes"
          Id="MyProductDesktopShortcut"
          Directory="DesktopFolder"
          Name="My Product"
          WorkingDirectory="INSTALLFOLDER"
          Description="My Product"
          Icon="MyProduct.ico">
          <Icon Id="MyProduct.ico" SourceFile="MyProduct.ico" />
        </Shortcut>
      </File>
    </Component>

    <Component Id="MyProduct.chm" Guid="*">
      <File Id="MyProduct.chm" Source="MyProduct.chm" KeyPath="yes" Checksum="yes"/>
    </Component>
    <Component Id="MyProduct.bmp" Guid="*">
      <File Id="MyProduct.bmp" Source="MyProduct.bmp" KeyPath="yes" Checksum="yes"/>
    </Component>
    <Component Id="MyProduct.ico" Guid="*">
      <File Id="MyProduct.ico" Source="MyProduct.ico" KeyPath="yes" Checksum="yes"/>
    </Component>

    <!-- Many, many more components... -->
  </DirectoryRef>

  <!-- Step 3: Tell WiX to install the files -->
  <Feature Id="MainApplication" Title="Main Application" Level="1">
    <ComponentRef Id="MyProduct.exe" />
    <ComponentRef Id="MyProduct.bmp" />
    <ComponentRef Id="MyProduct.ico" />
    <ComponentRef Id="MyProduct.chm" />

    <ComponentRef Id="ApplicationShortcut" />

    <ComponentRef Id="RegistryEntries" /> <!-- Registry entry -->
  </Feature>

  <InstallExecuteSequence>
    <!-- Before="InstallFinalize" -->
    <Custom Action="Install_PDF_printer" After="InstallFiles" />
  </InstallExecuteSequence>

  <!-- Calculate Trial Expiry date, write to Registry -->
  <InstallExecuteSequence>
    <Custom Action="DLLPlantSeed" After="InstallFiles" />
  </InstallExecuteSequence>  
</Product>

<Fragment>
  <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
    <!-- TODO: Remove the comments around this Component element 
      and the ComponentRef below in order to add resources to this installer. -->
    <!-- <Component Id="ProductComponent"> -->
      <!-- TODO: Insert files, registry keys, and other resources here. -->
    <!-- </Component> -->
  </ComponentGroup>
</Fragment>

【问题讨论】:

  • 我遇到了完全相同的问题(不过,只有安装 .NET 的引导程序)。附加信息:其上的 MSI 工作正常并正确显示其 UI。
  • 适用于UIRef Id="WixUI_FeatureTree"。也许 MSI 日志中的“命令行”条目会提供线索。
  • @Tom:如果 MSI 中的对话框是自定义的,那将如何工作?
  • 不应该有任何区别。我的意思是确定DisplayInternalUI 没有损坏。 Burn 不关心如何构建 Windows Installer 程序包。 Bundle 仅控制传递给 Windows Installer 的命令。它们是导致安装程序出现意外行为的原因,但它们本身可能并没有错。
  • MSI 中没有自定义对话框(参见上面的源代码)。当我添加&lt;UIRef Id="WixUI_FeatureTree"/&gt; 时,出现编译错误:error LGHT0091: Duplicate symbol 'ControlEvent:WelcomeDlg/Next/NewDialog/VerifyReadyDlg/Installed AND PATCH' found. 我看不到重复的来源。感谢您的帮助。

标签: wix windows-installer burn


【解决方案1】:

莫名其妙地,这件事现在似乎正在工作。我无法辨别众多排列中的哪一个“固定”了它。唯一想到的是每次都需要重新构建 MSI 项目,以及封装它的 Bootstrapper Application (BA)。

现在我需要取消 BA 显示的“安装成功”对话框。这是多余的,因为 MSI 对话框说同样的事情。

【讨论】:

    【解决方案2】:

    反之亦然:在MSI 中尝试supress WIX ExitDlg 并离开您的BA 对话框。

    【讨论】:

    • 谢谢,这会很有用。除了在这种情况下,我需要抑制 BA 对话框,并显示 MSI 对话框,因为 MSI 对话框具有“启动应用程序”选项。感谢您的反馈。
    【解决方案3】:

    只需添加DisplayInternalUI 标签。

    <MsiPackage SourceFile = 'xxx' Id='xxx' Vital='yes'  DisplayInternalUI='yes'></MsiPackage>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-10
      • 1970-01-01
      • 1970-01-01
      • 2022-11-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多