Bundle multiple support files for WiX Burn

自古美人都是妖i 提交于 2019-11-29 15:44:52

Inside the MsiPackage element use a bunch of Payload elements (or put the payloads elsewhere and use a PayloadGroupRef).

In compensation, your bootstrapper might get better compression since the MsiPackage is starting out exploded because double compression can be inefficient with time and space.

sloter1024

Thanks a million for this answer. With help of other posts (especially this one) I came up with xslt to also include Name attribute (with subfolders) and strip empty lines.

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:wix="http://schemas.microsoft.com/wix/2006/wi"
 xmlns="http://schemas.microsoft.com/wix/2006/wi">

<xsl:strip-space elements="*"/>

<xsl:template match="/">
<Wix>
  <Fragment>
    <xsl:apply-templates select="*" />
  </Fragment>
</Wix>
</xsl:template>

<xsl:template match="//wix:ComponentGroup">
<PayloadGroup>
  <xsl:attribute name="Id">
    <xsl:value-of select="@Id"/>
  </xsl:attribute>
  <xsl:apply-templates select="*" />
</PayloadGroup>
</xsl:template>

<xsl:template match="//wix:File">
<Payload>
  <xsl:attribute name="SourceFile">
    <xsl:value-of select="@Source"/>
  </xsl:attribute>
  <xsl:attribute name="Name">
    <xsl:call-template name="string-replace-all">
      <xsl:with-param name="text" select="@Source"/>
      <xsl:with-param name="replace" select="'$(var.SourceDir)\'"/>
      <xsl:with-param name="by" select="''"/>
    </xsl:call-template>
  </xsl:attribute>
</Payload>
</xsl:template>

<xsl:template name="string-replace-all">
<xsl:param name="text" />
<xsl:param name="replace" />
<xsl:param name="by" />
<xsl:choose>
  <xsl:when test="contains($text, $replace)">
    <xsl:value-of select="substring-before($text,$replace)" />
    <xsl:value-of select="$by" />
    <xsl:call-template name="string-replace-all">
      <xsl:with-param name="text"
      select="substring-after($text,$replace)" />
      <xsl:with-param name="replace" select="$replace" />
      <xsl:with-param name="by" select="$by" />
    </xsl:call-template>
  </xsl:when>
  <xsl:otherwise>
    <xsl:value-of select="$text" />
  </xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

I hope this will help you to automate Wix bootstapper builds.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!