I have been experimenting with and creating a project which uses heat to
harvest files.  Initially I did the development by creating a batch (cmd)
file which calls heat.  Now I am in the process of modifying my project file
to use the HeatDirectory task, and implement the equivalent of my batch
file.  I am observing some differences in the resulting files and have the
following questions.  (I am using the HeatDirectory task, rather than the
HarvestDirectory target, because I need to conditionally fire the task
several times with different parameters.)

The batch command that I used is essentially this:
"%WIX%\bin\heat.exe" dir "%HARVEST_PATH%" -nologo -dr %DIRID% -cg
%GROUP%Group -ag -sf -srd -suid -svb6 -scom -sreg -template fragment -indent
2 -var %VAR% -out "%OUTPUT_PATH%\hrv_%SUBFOLDERID%.wxs"

The resulting file has the basic form of:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi";>
    <Fragment>
        <DirectoryRef Id="project.binDir" />
    </Fragment>
    <Fragment>
        <ComponentGroup Id="project.binGroup">
            <Component Id="cmpID_A" Directory="RSDK.binDir" Guid="*">
                <File Id="filId_B" KeyPath="yes"
Source="$(var.SdkbinDir)\log.properties" />
            </Component>
            <Component Id="cmpId_B" Directory="RSDK.binDir" Guid="*">
                <File Id="filID_B" KeyPath="yes"
Source="$(var.SdkbinDir)\Api.dll" />
            </Component>
        </ComponentGroup>
    </Fragment>
</Wix>

When I try to get the same results as above, with the following
HarvestDirectory task parameters:
    <HeatDirectory Condition=" '0' == $(Exit) And '0' &lt; $(Return)"
ContinueOnError="ErrorAndStop"
      SuppressUniqueIds="true"
      NoLogo="true"
     ToolPath="$(WixToolPath)"
     AutogenerateGuids="true"
     SuppressFragments="true"
     KeepEmptyDirectories="false"
     SuppressCom="true"
     SuppressRootDirectory="true"
     SuppressRegistry="true"
     Transforms="$(TRANSFORMS)"
     Directory="$(HARVEST_PATH)"
     ComponentGroupName="$(GROUP)Group"
     DirectoryRefId="$(DIRID)"
     PreprocessorVariable="$(VAR)"
     OutputFile="$(OUTPUT_PATH)"
     Template="fragment" />

The resulting file has the following form:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi";>
    <Fragment>
        <DirectoryRef Id="RSDK.bin">
            <Component Id="cmpId_A" Guid="*">
                <File Id="filId_A" KeyPath="yes"
Source="$(var.Sdkbin)\log.properties" />
            </Component>
            <Component Id="cmpID_B" Guid="*">
                <File Id="filId_B" KeyPath="yes"
Source="$(var.Sdkbin)\Api.dll" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <ComponentGroup Id="RSDK.binGroup">
            <ComponentRef Id="cmpId_A" />
            <ComponentRef Id="cmpId_B" />
        </ComponentGroup>
    </Fragment>
</Wix>

It looks like the two approaches are functionally equivalent, but I was
wondering how to achieve the same output format as when using heat on the
command line, because to my eyes it is easier to read and maintain.  I
noticed that an equivalent for '-template fragment' is not documented for
the HarvestDirectory task, but I tried ' Template="fragment" ', which at
least does not result in an error. (Should either of these observations be
tracked in the issue tracker?)  I also tried to use Indent='2', but that
results in a HeatDirectory task error, so I do not know how to set the
Indention of the document.  If anyone has some pointers on these issues they
would be appreciated.

Another observation, which I found a workaround for, is that the heat
command -out "%OUTPUT_PATH%\hrv_%SUBFOLDERID%.wxs" works and the batch
strings are substituted.  However after changing the batch variables to
MSBuild Properties, when I tried to do -out
"$(OUTPUT_PATH)\hrv_$(SUBFOLDERID).wxs" it would result in an output path of
'\\hrv_bin.wxs' with one leading backslash).  So it resolved the
$(SUBFOLDERID) but did not resolve the $(OUTPUT_PATH), both of which were
defined in the same property group.  The solution was to define the whole
path in the same property group and then fire HeatDirectory
'OutputFile="$(OUTPUT_PATH)" '.  Does this last observation seem to be and
issue which should be added to the issue tracker?

Thank you for any comments that are provided!  Phill




--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Heat-command-line-vs-HarvestDirectory-task-tp7593917.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to