2
votes

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.

1
So, you'd like to merge the files? Always a good start: www2.informatik.hu-berlin.de/~obecker/XSLT/merge/…Mathias Müller
Yes, I need to merge the two files, but am unsure how to automate this. If I generate an xslt file, where do I use it?jostell13
Unfortunately, I am not familiar with heat or WIX, but in general, XSLT stylesheets are passed to an XSLT processor like Saxon or Xalan, together with an XML input (which in your case could be the files that should be merged). It is not really a matter of "generating" an XSLT file - you can download it from Oliver Becker's page.Mathias Müller

1 Answers

2
votes

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, say MyProgram:

<DirectoryRef Id="INSTALLFOLDER">
    <Directory Id="MyProgram" Name="MyProgram" />
</DirectoryRef>