Question

My problem is that heat.exe has no command line switch to set the "MultiInstance" attribute to "yes" (or even for setting arbitrary attributes). It seems like my only recourse is to supply the -t switch with a transform xslt. Does anyone already have an xslt that will include a MultiInstance="yes" attribute on on all harvested output component elements?

If I don't get any answers, I'll be authoring one myself, and will post it as an answer to this question.

Was it helpful?

Solution

What about this one? I basically copied it from second thread and modified few characters:

<xsl:stylesheet version="1.0"
            xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
            xmlns:msxsl="urn:schemas-microsoft-com:xslt"
            exclude-result-prefixes="msxsl"
            xmlns:wix="http://schemas.microsoft.com/wix/2006/wi"
            xmlns:my="my:my">

    <xsl:output method="xml" indent="yes" />

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

    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match='wix:Component'>
        <xsl:copy>
            <xsl:apply-templates select="@*"/>
            <xsl:attribute name="MultiInstance">
                <xsl:text>yes</xsl:text>
            </xsl:attribute>
        </xsl:copy>
    </xsl:template>
</xsl:stylesheet>

note that you might need to tune it a little bit more, depending what heat arguments you're currently using to generate wix files.

Alternatively you can download WiX heat source and add the argument yourself. In theory should be pretty easy.

WiX Installer: using xslt with heat.exe to update attributes

OTHER TIPS

Just share my file here, the one provide above might have some problems for File node.

<xsl:stylesheet version="1.0"
            xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
            xmlns:msxsl="urn:schemas-microsoft-com:xslt"
            exclude-result-prefixes="msxsl"
            xmlns:wix="http://schemas.microsoft.com/wix/2006/wi"
            xmlns:my="my:my">

    <xsl:output method="xml" indent="yes" />

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

    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match='wix:Component'>
        <xsl:copy use-attribute-sets='MultiInstanceSet'>
            <xsl:apply-templates select="@*|node()"/>

        </xsl:copy>
    </xsl:template>
    <xsl:attribute-set name="MultiInstanceSet">
      <xsl:attribute name="MultiInstance">yes</xsl:attribute>
    </xsl:attribute-set>

</xsl:stylesheet>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top