Page 1 of 1

How can I determine the location of a previous installation?

Posted: Tue Nov 07, 2006 11:05 am
by Steve
Hi there;
Hoping you can help me. I am trying to figure out how I can determine the location of where a user has installed my primary application. The reason that I need to know this is so that I can install addtional 'add-on' components to the same Installation folder location in which the primary application was originally installed.
Here is an example:
Let's say that I have installed the main application to C:\\Program Files\\MyApp
Now a month later the customer buys an add-on component that enables them to say, burn CD's. I need to place the CD burning add-on component into that same path/location (C:\\Program Files\\MyApp).
The problem of course is that the customer can install the main application anywhere they want so I can't rely on it always being in the default location.

Any help would be greatly appreciated...
Thanks,
Steve

Posted: Wed Nov 08, 2006 6:34 am
by muddasirqdiwai
hi try to create a registry where u save $TARGETDIR$ and when u run installer again just read it from same registry

Posted: Thu Nov 09, 2006 3:20 pm
by Steve
Thanks very much for the reply.
I figured that I would need to save that info to a ini or registry entry, however my problem is that being a newbie, I really don't understand the process involved in doing that within InstallAware.

Can anyone provide some additional details on how to do this?

Posted: Sat Nov 11, 2006 3:29 pm
by MichaelNesmith
Just use Write Registry, if you are working in the MSIcode view. OR, use the Registry view in the visual IDE. Create a new key somewhere in the registry, and record the value $TARGETDIR$.

To read the previous location, you want to use the Read Registry command in your MSIcode script. Find the line where $TARGETDIR$ is initialized (this is usually in the form "Set Variable TARGETDIR...". There, use Check Registry to see if your registry key exists. If it does, read the value and set $TARGETDIR$ to that value; otherwise, just accept the default value of $TARGETDIR$ (do not override).

Posted: Sun Nov 12, 2006 5:35 pm
by Steve
That works great!
Thanks very much Michael.

Posted: Mon Nov 27, 2006 4:59 pm
by mberterm
Microsoft explains that the need for storing this information is a 'problem of MSI properties not persisting across installations'

http://support.microsoft.com/default.as ... -us;251389

Posted: Mon Nov 27, 2006 5:33 pm
by MichaelNesmith
InstallAware lets you persist variables in your setup script across installations - working around this built-in MSI limitation. Just use the Set Variable command with the Persist check-box selected.