Animal Style
Animal Style

Reputation: 709

Generic Wix Installer for multiple projects

I am new to Wix so forgive me for any terms I may use incorrectly.

I have a large solution with many projects some of which become installable services, executables and what not. In the post build events of projects that will have an installer I run the following to generate a fragment containing all the files the installer will need.

"C:\Program Files (x86)\WiX Toolset v3.8\bin\heat.exe" dir $(TargetDir) -ag -cg harvestedComponents -out $(TargetDir)$(ProjectName).wxs

I want to create one single Wix setup project that has a component reference placeholder that I can then link to the fragment. This way I can reuse the functionality of the one setup project and not need a setup project for each installable item I have. From there I would have a second build event that would link/compile the fragment and project along with passing in flags to the generic installer project that could turn on/off install features, such as adding event source, different custom actions and such.

So my question is how do I link/compile a fragment with a generic Wix project from a post build event of the executable project. I am guessing it would look something like:

Candle/Light.exe fragment.wxs generic.wxs -eventLog true -customAction1 true -msiName MyInstaller.msi

Where I would use the values of eventLog customAction1 inside the generic file to enable/disable install features.

Sorry for the confusion and hope this is possible.

Upvotes: 1

Views: 1557

Answers (1)

taffit
taffit

Reputation: 2099

If I understood it correctly you want to reference the fragment created by heat ($(TargetDir)$(ProjectName).wxs) in your generic WiX source file?
If this is the case you just have to add a ComponentGroupRef-tag below your Feature-element (instead of a ComponentRef-element you would use normally). As Id for the elemenet you have to use the name of the ComponentGroup that you used in the heat-commandline, harvestedComponents in your example. E.g.

<Feature Id="MyFeature" ...>
    ...
    <ComponentRef Id="aNormalComponentFromTheCurrentFile" ... />
    ...
    <ComponentGroupRef Id="harvestedComponents" />
</Feature>

Or did I miss the point?

Upvotes: 1

Related Questions