Click here to Skip to main content
15,885,216 members

WIX: Is it possible to use a merge module multiple times?

Steven Ogilvie asked:

Open original thread
Hi,

I have 4 services merge modules... I have created a "Shared services merge module" that has 4 files that are required to be installed with each service (so I have 5 merge modules, 1 is shared between the other 4) The 4 services are installed to a unique directory i.e.:
C:\program files\company\product\services
Service1
Service2
Service3
Service4
and that shared merge module needs to install into each ServiceX directory...

I am running into problems trying to install that shared merge module here is some code:

XML
<Feature Id="Feature_1" Title="Main Feature" Description="This will installl the 1 Feature..." Level="1" Display="expand" ConfigurableDirectory="INSTALLFOLDER">
      <MergeRef Id="feature1mainmergemodule"/>
      <MergeRef Id="feature1mainmergemodule1"/>
      <MergeRef Id="FirstServicesMergeModule"/>
      <MergeRef Id="SecondtServicesMergeModule"/>
      <MergeRef Id="ThirdServicesMergeModule"/>
      <MergeRef Id="FourthServicesMergeModule"/>
      <MergeRef Id="SharedServicesMergeModule"/>
      </Feature>

          <Feature Id="Feature_2" Title="Main Feature" Description="This will installl the 2 Feature..." Level="1" Display="expand" ConfigurableDirectory="INSTALLFOLDER">
      <MergeRef Id="feature2mainmergemodule"/>
      <MergeRef Id="feature2mainmergemodule1"/>
      <MergeRef Id="FirstServicesMergeModule"/>
      <MergeRef Id="SecondtServicesMergeModule"/>
      <MergeRef Id="ThirdServicesMergeModule"/>
      <MergeRef Id="FourthServicesMergeModule"/>
      <MergeRef Id="SharedServicesMergeModule"/>
      </Feature>


I have a fragments for each service (so 4 in total for the services) so the SharedServicesMergeModule mrege module is referenced 4 times in each of the fragments, i.e.:


XML
      <Fragment>
  <Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="ProgramFilesFolder">
      <Directory Id="ProgramFilesFolder.MyCompany" Name="Company">
        <Directory Id="ProgramFilesFolder.MyProduct" Name="Product">
          <Directory Id="ProgramFilesFolder.Services" Name="Services">
            <Directory Id="ProgramFilesFolder.ServiceName" Name="Service1">
              <Merge Id="FirstServicesMergeModule" DiskId="1" SourceFile="..\Services\FirstServicesMergeModule\bin\$(var.Configuration)\FirstServicesMergeModule.msm" Language="1033"/>
              <Merge Id="SharedServicesMergeModule" DiskId="1" SourceFile="..\Services\SharedServicesMergeModule\bin\$(var.Configuration)\SharedServicesMergeModule.msm" Language="1033"/>
            </Directory>
          </Directory>
        </Directory>
      </Directory>
    </Directory>
  </Directory>
</Fragment>

Secondservice, thirdservice, fourthservice...


However when I compile the setup product wix I get these errors:

Error 12  The merge module 'SharedServicesMergeModule' contains a file identifier, 'File_ServiceAssembly.2FC299CF_7F63_460C_B60D_8F7C3FF8C3C7', that is duplicated either in another merge module or in a File/@Id attribute.  File identifiers must be unique.  Please change one of the file identifiers to a different value.  C:\Dev\Setup\Product.wxs    107 1   Setup


So my question is... How can a share 1 merge module with the four services merge module?

thanks,

Steve
Tags: Modules

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900