Tom
Tom

Reputation: 1

WiX: Features containing identical directories but must be merged into one unique directory during the installation

I am trying to create an installer for an application. My application contains a root application and a set of sub products that can be installed independently. I would like to create an installer to manage the installation by option.

After the compilation and linking, I get the following structure.

For MyAppRoot:

Each sub product has the same organisation:

For MySubPrd:

So I have a complete set of sub applications (MySubPrd1, MySubPrd2, ... , MySubPrdN).

During the installation, the SubPrd1 must be merged into MyAppRoot application (always installed).

To build my installer, I first harvest all the files in MyAppRoot and MySubPrd1, MySubPrd2, ... , MySubPrdN in order to create dedicated .wxs files associated to each SubProduct.

set ROOT_BINARY=D:\Prj\MyAppRoot
heat dir %ROOT_BINARY% -cg MyRootApp -gg -scom -sreg -sfrag -srd -dr INSTALLLOCATION  -out %OUT_BUILD_WXS%\root.wxs -var env.ROOT_BINARY

set ROOT_PRD1=D:\Prj\MySubPrd 
heat dir %ROOT_PRD1% -cg MySubPrd1 -gg -scom -sreg -sfrag -srd -dr INSTALLLOCATION  -out %OUT_BUILD_WXS%\prd1.wxs -var env.ROOT_PRD1

and the same for the others SubPrd's.

I have a main WXS file used to build my installer, I create a set a feature:

<Feature Id='Complete' 
         Title='ROOT Application' 
         Description='The application.' 
         Display='expand' 
         Level='3' 
         ConfigurableDirectory='INSTALLLOCATION'>
  <ComponentRef Id="Shortcut" />

  <Feature Id="RootApp" 
           Title="Main Application RootApp" 
           Description="...." 
           Level="3">
    <ComponentGroupRef Id="MyRootApp" />
  </Feature>

  <Feature Id="MySubPrd1App" 
           Title="Option1" 
           Description="...." 
           Level="1000">
    <ComponentGroupRef Id="MySubPrd1" />
  </Feature>

  <Feature Id="MySubPrd2App" 
           Title="Option2" 
           Description="...." 
           Level="1000">
    <ComponentGroupRef Id="MySubPrd2" />
  </Feature>

</Feature>

Everything is OK except during the link, I get many errors:

error LGHT0130 : The primary key 'dir022180FDDE4E69878C4D1206C73EED8D' is duplicated

After a check I found that the error is related to the directories. It seems WiX does not recognise that the features must be merged in the same path. Some of the directory contains exactly the same files (for example, ..\MyAppRoot\config\ws contains exactly the same files as ..\MySubPrd1\config\ws

How can I fix this problem?

Upvotes: 0

Views: 266

Answers (2)

alimbada
alimbada

Reputation: 1401

Where you have files that are common across Products, you could extract those out into Fragments and reference those fragments in each package.

Upvotes: 0

Rob Mensching
Rob Mensching

Reputation: 36006

You will have to use an XSL transform to clean up the output. heat doesn't understand overlap with other independent executions of heat today.

Upvotes: 1

Related Questions