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:
- ..\MyAppRoot\bin
- ..\MyAppRoot\config
- ..\MyAppRoot\config\http
- ..\MyAppRoot\config\was
- and other sub directory
- ...
Each sub product has the same organisation:
For MySubPrd:
- ..\MySubPrd\bin
- ..\MySubPrd\config
- ..\MySubPrd\config\http
- ..\MySubPrd\config\was
- and other sub directory
- ...
So I have a complete set of sub applications (MySubPrd1, MySubPrd2, ... , MySubPrdN).
During the installation, the SubPrd1 must be开发者_JAVA技巧 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?
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.
Where you have files that are common across Products, you could extract those out into Fragments and reference those fragments in each package.
精彩评论