We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

fpandolfi
Posts: 3
Joined: Sat Feb 23, 2019 5:23 pm

set main install directory for silent install from a custom action

I am trying to set the main application install directory, along with several other properties, from a custom action so that users can run a silent install from the command line and all parameters necessary for the install get set from a text file that is provided alongside the msi. This works fine for all the properties except for the install directory (APPDIR, I have also tried TARGETDIR). I have tried putting my custom action at various places in the install execution sequence but can't get it to work. The application always installs into the default (from the Install Parameters page) directory. Note that the value of APPDIR shown in the installation log file is correct but the application doesn't actually get installed there. Please help!

Thanks,
Fred
Catalin
Posts: 7853
Joined: Wed Jun 13, 2018 7:49 am

Re: set main install directory for silent install from a custom action

Hello Fred and welcome to our forums,

I am not sure why this happens. In order for me to further investigate this, could you please send me the verbose log of the installation where this behavior occurs?

You can either attach it here or send it by e-mail at support at advancedinstaller dot com.

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
fpandolfi
Posts: 3
Joined: Sat Feb 23, 2019 5:23 pm

Re: set main install directory for silent install from a custom action

Catalin,

I sent the log file a little while ago via email. Please let me know what I'm doing wrong.

Thanks,
Fred
Catalin
Posts: 7853
Joined: Wed Jun 13, 2018 7:49 am

Re: set main install directory for silent install from a custom action

Hello Fred,

Thanks for the provided files.

After further investigating this, I came to the conclusion that you are not setting the property correctly from within your custom action.

From what I could see in your .AIP file, I think that you are probably setting your properties from within the "SetServiceDefaults" custom action (please correct me if I'm wrong). First thing to notice here is the fact that it is enough to place the custom action before the "Searches" action group as you have already done. There is no need to place it once again after the "Preparing" action group. This is because properties are resolved to their values during the "CostFinalize" standard action (which is part of the "Paths Resolution" action group.

The second thing I could notice from the sent log is that the "SET_APPDIR" action is taking place. This action takes place only when, at the moment the action is executing, the APPDIR property is empty. The APPDIR property being empty makes me think that you are not correctly setting it from within your custom action. In a project where the APPDIR property was set before the "SET_APPDIR" action takes place, the log portion for "SET_APPDIR" action should look like this:

Code: Select all

MSI (s) (44:D8) [14:43:16:470]: Skipping action: SET_APPDIR (condition is false)
while in your sent log, it looks like this:

Code: Select all

MSI (s) (6C:BC) [08:47:06:369]: Doing action: SET_APPDIR
MSI (s) (6C:BC) [08:47:06:370]: PROPERTY CHANGE: Adding APPDIR property. Its value is 'C:\Program Files (x86)\Something\Something2'.
With that being said, could you please review your custom action's code once more and make sure that you are correctly setting the APPDIR property? Please have a look on our "How to set an installer property using custom actions" article for more information about this.

Hope this helps.

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
fpandolfi
Posts: 3
Joined: Sat Feb 23, 2019 5:23 pm

Re: set main install directory for silent install from a custom action

Catalin,

I think the problem might be that I'm trying to load the property values I want to use for the install from a file that is in the same directory as the MSI. In order to do this, I need to use the SOURCEDIR property. From looking at the logs, it looks like the SOURCEDIR property isn't set until later in the install sequence. As such, if I put my custom action early enough in the sequence to set the APPDIR property, the SOURCEDIR property, which I need, is empty. If I place my custom action late enough in the sequence that SOURCEDIR has been set, it's too late to set APPDIR. Does this sound right?

If I'm right in my paragraph above, where can I place my custom action so that it can determine the source directory (directory where msi is) and set the APPDIR?
Catalin
Posts: 7853
Joined: Wed Jun 13, 2018 7:49 am

Re: set main install directory for silent install from a custom action

Hello Fred,

Indeed, that may be the problem. The "SOURCEDIR" property is set a bit after "InstallInitialize" action (which takes place long time after the "APPDIR" property is set).
If I'm right in my paragraph above, where can I place my custom action so that it can determine the source directory (directory where msi is) and set the APPDIR?
I am afraid that this is not possible with the current configuration. However, you can make use of our "Temporary Files" support. Unlike Advanced Installer's regular files or resources, "Temporary Files" are copied on the target machine at the beginning of the installation and are deleted at the end of it, ensuring you have access to them throughout the entire install process. "Temporary Files" are copied during the CostFinalize standard action, at the beginning of the setup and removed during the InstallFinalize standard action. You can add a temporary file by going to "Files and Folders" page and by clicking the "Add Temporay Files" button from the toolbar.

With that being said, can you please try to add your file as a temporary file and let me know if that helps?

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”