ewanb
Posts: 28
Joined: Mon Jun 05, 2006 1:53 pm
Location: Glasgow

TARGETDIR resolving to APPDIR in merge module project

I have a merge module and I want to get the value of the TARGETDIR property into a registry entry but whenever I enter TARGETDIR into the 'Edit Registry Value' dialog AI resolves it to APPDIR. So I type:

Code: Select all

[TARGETDIR]MyApp.exe
and press OK and the value shows up as:

Code: Select all

[APPDIR]MyApp.exe
Unfortunately when I use my merge module the installer sets the target dir for the merge module to be a subfolder but in the merge module because TARGETDIR has been replaced with APPDIR I get the root path not the path where the merge module actually installs files.

I realise I could use a custom action to set a property in the installer (already doing that for some other paths) but that seems like overkill when the merge module clearly knows what the path should be since my files end up in the right place. Any suggestions?

Thanks,
Ewan
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: TARGETDIR resolving to APPDIR in merge module project

Hi Ewan,
whenever I enter TARGETDIR into the 'Edit Registry Value' dialog AI resolves it to APPDIR
This is because TARGETDIR is not resolved to an actual folder. It is actually a link between the installation folder of the merge module and the installation folder of the package. If you used TARGETDIR instead of APPDIR, then after the merge the MSI would also use TARGETDIR.

However, what you need can be done in two ways:
1) Use APPDIR in the merge module like any other merge module property (append to its name the GUID of the merge module). Therefore, instead of writing into the registry [APPDIR]MyApp, you will write:

Code: Select all

[APPDIR.DCE47EB2_4B03_4ABD_AC05_FC71936A5DD0]MyApp
where you replace "DCE47EB2_4B03_4ABD_AC05_FC71936A5DD0" with the GUID of your merge module.

2) In the merge module project you can create a sub-folder for "Application Folder". This sub-folder will contain the merge module files and it will have the Install folder content into the parent folder option set. Also, in the registry value you will use this sub-folder instead of TARGETDIR.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ewanb
Posts: 28
Joined: Mon Jun 05, 2006 1:53 pm
Location: Glasgow

Re: TARGETDIR resolving to APPDIR in merge module project

I tried using [APPDIR.GUID] as suggested but it came up with a blank string during install. However the second approach worked perfectly.

Thanks,
Ewan

Return to “Common Problems”