使用wix heat.exe获取多个文件时自定义KeyPath项

Daf*_*ong 8 wix

我在wix中的每个用户安装项目中收集了大量文件.

我使用heat.exe来获取文件,但是一个组件中的每个文件都有自己的keypath属性,而我的文件将复制到"app data",因此它必须使用HKCU下的注册表项作为其KeyPath,所以我必须更改XML文件中的每个项目.

可以通过heat.exe来完成吗?我有数千个文件要收获,手动修复它很糟糕.

Ujj*_*ngh 6

使用此选项xslt可以自定义KeyPath具有子节点的节点的项目.

<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:Wix/wix:Fragment/wix:ComponentGroup/wix:Component'>
        <xsl:copy>
            <xsl:apply-templates select="@*"/>
            <xsl:attribute name="KeyPath">
            <xsl:text>no</xsl:text>
            </xsl:attribute>
            <xsl:apply-templates select="node()"/>
        </xsl:copy>
    </xsl:template>
</xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud)

源自@KirillPolishchuk的回答/sf/answers/562453461/


Yan*_*nko 1

据我所知,热量不支持这种开箱即用的方式。但是,您可以将 XSL 模板应用于热输出,并按照您想要的方式调整最终的 wxs 文件。有关详细信息,请参阅 -t:heat.exe 的开关。