Wix Heat output not referencing directory like I want
Asked Answered
R

3

13

So here's the basic setup. I have an existing WIX project that builds a bunch of individual fragments in to a larger MSI. I'm trying to change the project around to allow you to select individual pieces to install. The program I've run in to is that when I run heat on the smaller directories to create the individual components, the Source path isn't correct. I'll give an example as hopefully that will make more sense.

So I have basic folder structure like this:

C:\ProjDir\Foo\Bar1
C:\ProjDir\Foo\Bar2

I used to a command to simply harvest C:\Foo (Heat.exe dir Foo -dr FOO_DIR_REF -out File.wxs), and now I've changed it to to harvest each individual Bar folder (Heat.exe dir Foo\Bar1 -dr BAR1_DIR_REF -out File1.wxs) and (Heat.exe dir Foo\Bar2 -dr BAR2_DIR_REF -out File2.wxs). The problem I'm having is that the output of the harvest looks like this:

<Component Id="cmpblablabla" Guid="{stuff-here}">
    <File Id="filblabla" KeyPath="yes" Source="SourceDir\Bar1\file.here" />
</Component>

And when trying to build the msi it complains because it can't find SourceDir\Bar1. Basically what I need is a way to make it look something like this:

<Component Id="cmpblablabla" Guid="{stuff-here}">
    <File Id="filblabla" KeyPath="yes" Source="SourceDir\Foo\Bar1\file.here" />
</Component>

This seems like a very simple problem, that I'm sure is easily done, but all the searching I've done has not come up with anything useful.

Rodriguez answered 2/8, 2011 at 16:46 Comment(0)
W
14

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 ...
Whiskey answered 3/8, 2011 at 2:22 Comment(1)
This was exactly what I needed. Thanks a lot. Good to know you can specify multiple -b as well.Rodriguez
B
2

It should be

<Component Id="cmpblablabla" Guid="{stuff-here}">
    <File Id="filblabla" KeyPath="yes" Source="$(var.ProjectName.TargetPath)\Bar1\file.here" />
</Component>

Different properties available are

  • $(var.ProjectName.TargetPath)
  • $(var.ProjectName.ProjectDir)
Barthel answered 2/8, 2011 at 18:7 Comment(1)
Do you know how to do that using heat? I know the -var var.ProjectName.TargetPath will get me the first part, but what I need is the Bar1, and I haven't found a way to do that through heat. I know I can edit the file manually, but I was trying to do this in an automated way.Rodriguez
H
2

The answer to your question is all in heat.exe help text. :-)

In order to end up with correct directory harvesting, point the heat to your root directory (Foo), and specify the -srd switch in the command line. As the help text states, this will omit root dir harvesting and you'll most likely end up with what you need.

For even more flexibility, you can specify -var switch providing the WiX variable which is to replace the SourceDir explicit statement. Again, just run heat.exe and look through the output - you'll find enough info and examples.

Helpless answered 2/8, 2011 at 19:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.