I have this WIX command that uses all invariant paths and it doesn't need a system environment (unlike this example http://weblogs.sqlteam.com/mladenp/archive/2010/02/23/WiX-3-Tutorial-Generating-filedirectory-fragments-with-Heat.exe.aspx):
"%wix%bin\heat.exe" dir "$(SolutionDir)Web\obj\$(Configuration)\Package"
-cg PACKAGEFILES -gg -g1 -sreg -srd -dr DEPLOYFOLDER
-var wix.PackageSource="$(SolutionDir)Web\obj\$(Configuration)\Package"
-out "$(SolutionDir)WebInstaller\PackageFragment.wxs"
It works great, except on our build server where the solution path has a space in it and this error is thrown:
heat.exe error HEAT5057: The switch '-var' does not allow the spaces from the value. Please remove the spaces in from the value: wix.PackageSource=C:\Build\Builds 1\26e27895ae75b7cb\CADPortal\src\trunk\Web\obj\Debug\Package
I can't change the path and it shouldn't be necessary anyway in my opinion.
My question is: How do I solve this? (I don't even get why WIX is making trouble over a quoted path/string var with a space)
To include a variable and its definition using heat, use the following mechanism.
<?xml version="1.0" encoding="utf-8"?>
<Include>
<?define PackageSource="c:\somePath"?>
</Include>
<?include myinclude.wxi?>
to the wxs file:<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wix="http://schemas.microsoft.com/wix/2006/wi">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="wix:Wix">
<xsl:copy>
<xsl:processing-instruction name="include">myInclude.wxi</xsl:processing-instruction>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<!-- Identity transform. -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Run heat and specify the -t parameter that points to the transform:
heat.exe dir "c:\somePath" -cg PACKAGEFILES -gg -g1 -sreg -srd -dr DEPLOYFOLDER -var PackageSource -t mytransform.xsl -out PackageFragment.wxs
This will create the PackageFragment.wxs file as intended, add the include statement using the xsl transform, and use the variable value from the wxi file when compiling the msi (using candle later on).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With