Merge module files into different locations
Asked Answered
A

4

1

I'd like to parse merge module files into two different locations. Is it possible?

    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="MergeRedirectFolder">

        <Component Id="LoggerClient" Guid="*">
          <File Id="log4net" Name="log4net.dll" Source="..\..\_Release\log4net.dll" KeyPath='yes' />
          <File Id="LoggerLibrary" Name="LoggerLibrary.dll" Source="..\..\_$(var.Configuration)\LoggerLibrary.dll" />
          <File Id="app.config" Name="app.config.xml" Source="..\..\_Release\app.config.xml" />
          <File Id="msvcr110.dll" Name="msvcr110.dll" Source="c:\windows\sysWoW64\msvcr110.dll" />
        </Component>

  </Directory>
    </Directory>
</Module>



<Merge Id ="MergeModule.msm" Language ="!(loc.Lang)" SourceFile ="_$(var.Configuration)\MergeModule.msm" DiskId ="1" />

I want the second file to copy to a different folder than the other files.

Acquire answered 5/5, 2015 at 8:6 Comment(4)
Not sure if I understood correctly - you can set different target destinations for each file in a merge module. If you use Wix I would use Wix include files instead - it has the same effect as a merge module, but is more flexible.Outmarch
To get familiar with Wix try these suggestions: Getting familiar with Wix. You can also try to decompile a complex merge module *.msm file to see if it creates Wix XML that you can use to adapt to your purpose. (not sure if Wix can decompile msm files, but it can decompile msi files).Outmarch
There is also a template in visual studio to start a merge module project, but I guess you found that already.Outmarch
Your example breaks at least 2 component rules. You can't have multiple DLL's in a single component and a single component can't install to multiple directories.Chrysotile
G
1

There is a concept for that, it is called a retargetable merge module. I have avoided used it - the concept doesn't seem right to me. I have not tried to make one with Wix.

I think you could combine a Wix include file (simple sample) with the new auto-generated component guids to deploy such duplicated files reliably by adding an Include statement where appropriate. You must not hard code the guids in this case, but let them be auto generated by the Wix compiler and linker.

Also have a read of WixLibs (Wix library files): http://robmensching.com/blog/posts/2008/10/10/what-are-.wixlibs-and-why-would-you-use-them/

Wix documentation; http://wixtoolset.org/documentation/manual/v3/overview/files.html

Geary answered 5/5, 2015 at 9:51 Comment(1)
Personally I use merge modules so that I can interop with other Windows Installer authoring tools. Wixlibs are lighter weight but are specific to WiX.Chrysotile
G
0

Merge modules are for installing common runtimes and genuinly shared files. Typically C and C++ runtimes and other, similar libraries that should be available in the latest version for all applications.

Your files look like they are part of your application folder, with the exception of msvcr110.dll which you should remove and allow to be loaded from the system folder.

If the remaining files have no per-machine registration (COM for example or COM Interop), you can duplicate them in several folders without interference, yes, but why not load them from a shared location inside your own application folder structure?

  • %ProgramFiles%\My Company\My Shared Runtimes
  • %ProgramFiles%\My Company\My Apps\My App 1\
  • %ProgramFiles%\My Company\My Apps\My App 2\

These sample folders you "own" and you can deploy things here however you like. Not so for shared, system folders. You could make your own merge module for shared components between your applications into "My Shared Runtimes" and make your applications aware of the shared location "....\MySharedRuntimes\"

Geary answered 5/5, 2015 at 8:23 Comment(3)
thanks for your fast replay , however i want to use one merge module while each file will be set into different folderAcquire
Stein, I disagree with your "geniunly" shared files statement. Merge modules make a great paradigm for encapsulating collections of components for creating distributed installer sources (think AGILE). In fact, that's about the only thing I use them for these days. Merge Modules failed so bad a true shared scenarios that it is very often best to not use them for that.Chrysotile
I don't use merge modules at all except for shared components from Microsoft not packaged in other ways. Otherwise I prefer to use include files in Wix.Outmarch
N
0

It depends on what you mean by different locations. You can build a merge module with 4 files, each in their own component and directory. One could go to the CommonFilesFolder; another to the SystemFolder; another to...you get the idea. So it's potentially easy if you make each file its own component in its own directory. However you've got them all under TARGETDIR, so you're going the wrong direction. You just define the other directory and that other component and file and you might be done, unless there's more to the question than meets the eye.

Nakano answered 5/5, 2015 at 18:49 Comment(0)
C
-1

I would suggest contacting me privately for a few 30-60 minute conversation on MSI, component rules, Merge Modules and file set theory. It's too much to write. In a nutshell I would advise more merge modules.

Chrysotile answered 5/5, 2015 at 15:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.