views:

47

answers:

2

Hi, I am newbie to Wix and creating a multi feature Wix project. Our product is having 4 modules and each module has to be included as a feature in the Windows installer. But all features are sharing the same folder structure.

I am using commandline to build my Wix project. After harvesting every module into different wxs fragments, the light.exe giving error saying that duplicate id in the dirercoty table.

My file tree is look like...

    ModuleA - Core
 |--bin
 |--etc
 |   |--mgr
 |--lib
 |-- a.txt

ModuleB
 |--bin
 |--etc
 |   |--mgr
 |--lib
 |-- b.txt

ModuleC 
 |--bin
 |--etc
 |   |--mgr
 |--lib
 |-- c.txt

I am using following commands...

@echo Harvesting target files....
heat.exe dir .\Mod1 -cg Mod1ComponentGroup -nologo -gg -scom -sfrag -sreg -srd -ke -dr INSTALLLOCATION -var var.mod1files -out Mod1Files.wxs

heat.exe dir .\Mod2 -cg Mod2ComponentGroup -nologo -gg -scom -sfrag -sreg -srd -ke -dr INSTALLLOCATION -var var.mod2files -out Mod2Files.wxs

heat.exe dir .\Mod3 -cg Mod3ComponentGroup -nologo -gg -scom -sfrag -sreg -srd -ke -dr INSTALLLOCATION -var var.mod3files -out Mod3Files.wxs

@echo Compile modules....
candle.exe -nologo myproj.wxs Mod1Files.wxs Mod2Files.wxs Mod3Files.wxs -dmod1files =.\Mod1 -dmod2files=.\Mod2  -dmod3files=.\Mod3

@Creating MSI...
set msi_name=MYProduct.1.0.12345.Win32.msi

light.exe -nologo -ext WixUIExtension -cultures:en-us myproj.wixobj Mod1Files.wixobj Mod2Files.wixobj Mod3Files.wixobj -o %msi_name%

Is there any way to avoid the Duplicate ID error?

Any help would be really appreciated.

Thanks in Advance.

Muthu

+2  A: 

If you were using Merge Modules this would be ok because each ID would be appended with a unique module ID. ( dir1.GUIDA, dir1.GUIDB, dir1.GUIDC ) If you are using fragments you either have to change the ID's or normalize the directory structure into a single wxs and use a DirectoryRef to pull it into your other wxs with your components.

I'm not sure Heat can handle all of this automatically. It's really just more of a starting point.

Christopher Painter
Thanks a lot Christopher. This could be a starting point for me. I will start looking into the merge module.
Muthukkumaran
Take a look at iswix.codeplex.com also. It does a pretty good job of hashing and sorting wxs files for merge modules. (Disclaimer: My project )
Christopher Painter
Using merge modules working seamlessly for me. Thanks again for your comments.
Muthukkumaran
Great. Can you accept the answer? :-)
Christopher Painter
Yes. Five stars for your comments. I am still adding more functionalites to my mergemodules like, custom actions, unintall, etc.
Muthukkumaran
A: 

I also had the problem where i would generate multiple component groups based on fodlers that would end up in the same target installation folders.

If you have cygwin installed to make use of unix tools, what i did to eliminate those duplicate IDs is to use "sed" after each heat.exe command line to add a prefix to all the ids. I just add those sed commands to be part of the WIX pre-build step just like the heat ones.

For example:

sed -i 's/Directory\ Id=\"/Directory\ Id\"mod1/g' "generatedfile.wxs"

This command line would replace all ( Directory Id="..." ) by ( Directory Id="mod1..." )

It works great because those directory are not referenced but just included in the components which then are referenced in groups.

Hope that helps

Thanks a lot. But I don't have CygWin installed.
Muthukkumaran