TARGETDIR being set incorrectly

Got a problem you cannot solve? Try here.
Dan Fisher
Posts: 15
Joined: Tue Sep 05, 2006 6:40 am
Location: UK

TARGETDIR being set incorrectly

Postby Dan Fisher » Thu Sep 07, 2006 4:25 am

A script was working fine, at least in regard to the target directory defaulting to what I'd specified in the Project Properties ($PROGRAMFILES$\\SomeFolder). I then found that this was not what was required and changed it to $PROGRAMFILES$\\SomeOtherFolder. What now happens is that $TARGETDIR$ is being set to $PROGRAMFILES$\\$TITLE$, which is not what I want at all.

I can't see any lines that would cause this in the script (in fact it's already been set to the incorrect value when the script starts). Is there anywhere this value might have got 'stuck' - some supporting file I need to recreate, perhaps?

Cheers
Dan

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Postby MichaelNesmith » Thu Sep 07, 2006 6:40 am

Use the Project Properties window, Target Folder field to customize your destination folder. You should also always use $TARGETDIR$ as the destination of your files (or its subfolders), or this setting won't have effect.
Michael Nesmith
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/

Dan Fisher
Posts: 15
Joined: Tue Sep 05, 2006 6:40 am
Location: UK

Postby Dan Fisher » Thu Sep 07, 2006 7:35 am

Thanks for the reply, but I am using the Project Properties | Target Folder field to specify the destination folder, it's just that the setup doesn't seem to be taking any notice of it, and the value of $TARGETDIR$ is wrong at the start of the script.

Also, when running an upgrade (i.e. changed version code), $TARGETDIR$ is still wrong, and doesn't take any notice of where the app was installed to in the original installation.

As I say, this was all working fine until I changed the Project Properties | Target Folder value. This is a problem, because I need to get info from the original installation files before the Remove MSI Package command is issued, but the upgrade is now looking for the files in the wrong folder.
Dan

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Postby MichaelNesmith » Thu Sep 07, 2006 7:52 am

I'd switch to the MSIcode view and search for "Set Variable TARGETDIR" and see what comes up. There should be one line like that which the visual UI updates, any mistakes/misplacements/other lines lying around can cause problems.
Michael Nesmith

InstallAware

Home of The Next Generation MSI Installer

Get your free copy today - http://www.installaware.com/

Dan Fisher
Posts: 15
Joined: Tue Sep 05, 2006 6:40 am
Location: UK

Postby Dan Fisher » Thu Sep 07, 2006 8:05 am

Yep, there one line that sets TARGETDIR to the correct value in the Setup Globals region. My problem is that I need the value before that point, so that I can read from previously installed files before the remove takes place (and so that upgrade/maintenance runs don't use the default location, rather than the location originally specified by the user).

I don't understand what's going on here, because originally the script started with the correct value for TARGETDIR - it's only gone wrong since I altered it in the Project Properties. Do I need to recreate the project from scratch?
Dan

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Postby MichaelNesmith » Thu Sep 07, 2006 8:54 am

If you want to read from previously installed files, reading $TARGETDIR$ is not what you want to do. $TARGETDIR$ stores the value for your setup instance, not an older setup instance. If you were maintaining the same setup version, sure - $TARGETDIR$ would hold the correct value. However that is not what you're trying to do, is it?

All Project Properties does is update the $TARGETDIR$ variable using the Set Variable command that you already found in the script. If the variable has the correct value after this line runs, you don't have any problems. If you need that default value earlier in the script, simply cut and paste that line to where you need it.

But remember, this will not tell you where the previous version of setup was installed!
Michael Nesmith

InstallAware

Home of The Next Generation MSI Installer

Get your free copy today - http://www.installaware.com/


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 42 guests