My WiX installer project has two .dlls that I need to register, so I have two heat.exe calls in my prebuild, which each output a .wxs file that creates a component and a directoryref. The problem lies with the fact that an install directory must be specified for each. If I specify INSTALLFOLDER for both, an error gets thrown later because I have duplicate IDs (understandable, both directories are getting a directoryref element in the respective wxs files)
My setup:
DllReg1.wxs:
<Fragment>
<DirectoryRef Id="INSTALLFOLDER">
<Directory Id="dir581D83B1FCCC198EE5DE7DEB6BA83639" Name="MyProgram" />
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="MyComReg1">
<!--MyComponentGroupDetails-->
</ComponentGroup>
</Fragment>
DllReg2.wxs:
<Fragment>
<DirectoryRef Id="INSTALLFOLDER">
<Directory Id="dir581D83B1FCCC198EE5DE7DEB6BA83639" Name="MyProgram" />
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="MyComReg2">
<!--MyComponentGroupDetails-->
</ComponentGroup>
</Fragment>
What I need is one .wxs file that contains both:
<Fragment>
<DirectoryRef Id="INSTALLFOLDER">
<Directory Id="dir581D83B1FCCC198EE5DE7DEB6BA83639" Name="MyProgram" />
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="MyComReg1">
<!--MyComponentGroupDetails-->
</ComponentGroup>
<ComponentGroup Id="MyComReg2">
<!--MyComponentGroupDetails-->
</ComponentGroup>
</Fragment>
Is there a decent way with a transform to select just the components from both and the directoryref from one and copy all to a new .wxs file?
I realize that heat will allow for harvesting multiple source files into a single .wxs, but this option will not be as smooth as a transformation after the fact. Currently I am hand editing the final .wxs file, but this is obviously not ideal.
Thanks in advance.
There is no need to combine outputs. Use the
-srd
switch with the-dr
switch. You might then need to define the directory referenced by dr, sayMyProgram
: