views:

510

answers:

1

Hi,

I’m trying to change the destination of a merge module at run time...

Let me explain: I have a merge module, which its destination is set to the [SystemFolder] folder.

And I have a lot of MSI projects point to this one merge module, all pointing the merge module (Component) destination to ‘(Use merge module's default destination)’.

The Issue: One of the MSI Projects needs to install the merge module to the ‘Common File’ location (not the systyem32 folder).

So if I change the merge module (Component) destination in the MSI project to [CommonFileFolder] nothing happens (because merge module destination is still set to [SystemFolder])

Or, if I change the merge module destination to be [TARGETDIR] and then change my merge module (Component) destination in the MSI project to [CommonFileFolder], then that works fine. But then all my other MSI projects will then install the merge module to the root drive because the other MSI projects are still pointing the merge module (Component) destination to ‘(Use merge module's default destination)’.

I can’t do these two things: I don’t want to change every single MSI project to either [SystemFolder] or [CommonFileFolder]).

And I also don’t want to create two identical merge modules (one pointing to [SystemFolder] and the other point to [CommonFileFolder]), so I only have to change the one MSI project

Is they a way I could change the merge module destination if the MSI project is point the merge module to ‘(Use merge module's default destination)’?

For example: If TARGETDIR = ‘(Use merge module's default destination)’ then set the TARGETDIR = [SystemFolder] Else use the [TARGETDIR]

Or is there another way I could fix this?

Thanks BillyBobLee

A: 

When you create the component in the merge module, leave the Destination to INSTALLDIR.

When you consume the merge module in your basic msi project ( redistributables view ) right click the merge module and select properties. Then use the Destination drop down to configure the relationship. The file in the merge module will now go where you tell it to.

Side note, once merged, merge modules no longer exist. Take a look at the built MSI in Orca and you'll see that there are directory table entries that look like this ( Let's assume you configured the module for SystemFolder )

DIR | DIR_PARENT | DefaultDir

TARGETDIR SourceDir ProgramFilesFolder TARGETDIR .:PROGRA~1|program files ISMyCompanyDir ProgramFilesFolder MYCOMP~1|My Company Name ISMyProductDir ISMyCompanyDir MYPROD~1|My Product Name INSTALLDIR IsMyProductDir . INSTALLDIR.SOMEGUID SystemFolder .

The "." represent 'current directory' or 'same as parent'.

So in this case you build up that INSTALLDIR = C:\Program Files\My Company Name\My ProductName\ and that INSTALLDIR.SOMEGUID = C:\Windows\System32

Make sense? In this way you can consume the module in different products deploying to different locations.

Christopher Painter