wix toolset将 cab 打包进msi

Posted 愤怒的企鹅

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了wix toolset将 cab 打包进msi相关的知识,希望对你有一定的参考价值。

在***wxs中添加配置

<MediaTemplate EmbedCab="yes" />

下面是一个简单配置:(包含写注册表)

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Name="xyz" Language="1033" Version="1.0.0.0" Manufacturer="app" UpgradeCode="1eb8f796-3b8e-41d6-9951-9d70b8630e69">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
    
        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
        <MediaTemplate EmbedCab="yes" />
    
        <Feature Id="ProductFeature" Title="xyz" Level="1">
            <ComponentGroupRef Id="ProductComponents" />
      <ComponentRef Id="RegistryEntry" />
        </Feature>
    </Product>
  
    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLFOLDER" Name="xyz" />
            </Directory>
        </Directory>
    </Fragment>

    <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> -->    
    
      <Component Id="ProductComponent" Guid="0E5598EB-B3B8-4EF5-8E8A-78A7133B6D34">
          
          <File Id="xyz.exe" Source="xyz.exe" />
          <File Id="libxxx.dll" Source="libxxx.dll" />
          <File Id="msvcp120.dll" Source="msvcp120.dll" />
          <File Id="msvcr120.dll" Source="msvcr120.dll" />
          <File Id="vccorlib120.dll" Source="vccorlib120.dll" />
          <File Id="test.html" Source="test.html" />
          <File Id="reg_test.reg" Source="reg_test.reg" />
      </Component>
        </ComponentGroup>
    </Fragment>
  <Fragment>
    <DirectoryRef Id="TARGETDIR">
    <Component Id="RegistryEntry" Guid="B0464DA0-31B9-4DD1-B058-8CD19D07612F">
        <RegistryKey Root="HKCR" Key="xyz">          
           <RegistryValue Type="string" Value="xyz Protocol" /> 
           <RegistryValue Type="string" Name="URL Protocol" Value=""  />            
        </RegistryKey>
        <RegistryKey Root="HKCR" Key="xyz\DefaultIcon">          
          <RegistryValue Type="string" Value="[INSTALLFOLDER]xyz.exe,1" />           
        </RegistryKey>
        <RegistryKey Root="HKCR" Key="xyz\shell\open\command">          
          <RegistryValue Type="string" Value="&quot;[INSTALLFOLDER]xyz.exe&quot; &quot;%1&quot;" />           
        </RegistryKey>
    </Component>
</DirectoryRef>
  </Fragment>
</Wix>

 

以上是关于wix toolset将 cab 打包进msi的主要内容,如果未能解决你的问题,请参考以下文章

使用Wix将整个目录添加到MSI数据库的规范方法是什么?

用于包装的 WiX 工具

在 Visual Studio 2008 中将目录添加到 CAB 项目

如何使用 WiX 从源代码重建完全相同的 msi 文件?

在Wix Toolset中的卸载过程中隐藏/显示控件

WiX MSI 和 EXE 作为一个 EXE