heat generated files are not able to find SourceDir directory
Asked Answered
V

2

19

I am running heat to generate a wxs file. The code are as follows.

I want to add all the files from dir.prompts to the wxs file in the installer. And I added this to be a part of the automated build process ( so that I cant modify the wxs file once it has been generated).

The wxs file is generated, and it looks something like the following. Hoewever, then Light complains it can not find where SourceDir\Valid.wav is. So I guess my question is, is SourceDir the directory that I am reading the files from, or some magic directory that i am not aware of? Many thanks.

 <Fragment>
    <ComponentGroup Id="COMPONENTS">
        <Component Id="dmp120F8C2794******" Directory="dir31A7EE61C56025FE2564A81E28E8C132" Guid="{6D40EBC0-***-***-B972-**********}">
            <File Id="fil919100C2******D045EC131" KeyPath="yes" Source="SourceDir\Valid.wav" />
        </Component>



<exec program ="${dir.wix}\heat.exe">
  <arg value = "dir"/>
  <arg line = "${dir.prompts}"/> 
  <arg value= "-gg"/>
  <arg line="-cg &quot;COMPONENTS&quot;"/>
  <arg line = "-out  &quot;${dir.thisinstaller}\\COMPONENTS.wxs&quot;"/> 
</exec>
Vivavivace answered 13/12, 2011 at 15:51 Comment(0)
B
14

You should add -var switch to heat command line:

From heat.exe help:

-var VariableName substitute File/@Source="SourceDir"

with a preprocessor or a wix variable. For example:

-var var.MySource

will become File/@Source="$(var.MySource)\myfile.txt"

and

-var wix.MySource

will become File/@Source="!(wix.MySource)\myfile.txt"

Basting answered 21/12, 2011 at 13:8 Comment(4)
But then we need to add an "include" header so it will recognize the variable. right?Snowplow
yes but that's manual work. Would love an answer on how to have that done automatically if possible.Airedale
Is there a way, where we can give the path of the SourceDir without Environment variable?Inimical
You can use a Transform to add an include header through Heat. windows-installer-xml-wix-toolset.687559.n2.nabble.com/…Alunite
D
20

Note that light will search additional SourceDir's for your file if you add them to the search path with -b

e.g.

light.exe -b Foo ...

(Answer from: https://mcmap.net/q/666440/-wix-heat-output-not-referencing-directory-like-i-want )

Deedeeann answered 5/9, 2012 at 16:37 Comment(2)
How do I do this from a visual studio project?Ameliaamelie
In Visual Studio: Project Properties > Tool Settings > Linker. Type -b path. Or, add a LinkerBindInputPaths element to a PropertyGroup in your .wixproj file.Cuba
B
14

You should add -var switch to heat command line:

From heat.exe help:

-var VariableName substitute File/@Source="SourceDir"

with a preprocessor or a wix variable. For example:

-var var.MySource

will become File/@Source="$(var.MySource)\myfile.txt"

and

-var wix.MySource

will become File/@Source="!(wix.MySource)\myfile.txt"

Basting answered 21/12, 2011 at 13:8 Comment(4)
But then we need to add an "include" header so it will recognize the variable. right?Snowplow
yes but that's manual work. Would love an answer on how to have that done automatically if possible.Airedale
Is there a way, where we can give the path of the SourceDir without Environment variable?Inimical
You can use a Transform to add an include header through Heat. windows-installer-xml-wix-toolset.687559.n2.nabble.com/…Alunite

© 2022 - 2024 — McMap. All rights reserved.