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\Bar2I 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="cmpblablabl开发者_JAVA百科a" 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.
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 ...
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)
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.
精彩评论