1

I have created two separate msi for using Wix toolset:
- Windows application
- Windows service

Goal

Want to have one msi which can install both :
- Windows application
- Windows service

Problem

Is it possible using WiX ?
Can we make use of merge module to include both msi into one msm ? if yes, How ?

Edit 1

Getting an error -

The Directory with Id 'TARGETDIR_WindowsService' is not a valid root directory. There may only be a single root directory per product or module and its Id attribute value must be 'TARGETDIR' and its Name attribute value must be 'SourceDir'

If i am not changing the TARGETDIR then duplicate error is coming for both "TARGETDIR" and "ProgramFilesFolder".

alrightyy
  • 113
  • 1
  • 6

1 Answers1

2

Yes, you can. You put them in different features. You can then build a UI to launch the app install, the service install or both.

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Name="SetupProject1" Language="1033" Version="1.0.0.0" Manufacturer="YourCompany" UpgradeCode="3fdc2c3a-72f3-4a5f-a182-3905272bf888">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
        <MediaTemplate />

        <Feature Id="ProductFeature" Title="My Application" Level="1">
            <ComponentGroupRef Id="ProductComponents" />
        </Feature>
        <Feature Id="ServiceFeature" Title="My Service" Level="1">
            <ComponentGroupRef Id="ProductComponents" />
        </Feature>
    </Product>

    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLFOLDER" Name="MyApplication" />
                <Directory Id="SERVICEFOLDER" Name="MyService" />
            </Directory>
        </Directory>
    </Fragment>

    <Fragment>
        <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
        </ComponentGroup>
        <ComponentGroup Id="ServiceComponents" Directory="SERVICEFOLDER">
        </ComponentGroup>
    </Fragment>
</Wix>
  • Hi Patrik,@patrik, tried the above mentioned approach, getting the error as menitoned in the EDIT -1 section – alrightyy Nov 16 '17 at 09:14
  • @alrightyy See my updated answer. För more information on how to use Wix I suggest [link](https://www.firegiant.com/wix/tutorial/) – Patrik Tengström Nov 16 '17 at 14:37