Command Line APPDIR being overwritten - Advanced Installer Community
adamdc78
Posts: 76
Joined: Wed Mar 19, 2014 7:42 pm

Command Line APPDIR being overwritten

Here are a subset of the installation log entries:

Code: Select all

MSI (s) (6C:C8) [12:10:57:473]: Command Line: OUTLOOK_IS_32BIT=1 RELEASE_LOTUS=1 LOG_FILE_PATH=C:\Users\MyUser\AppData\Local\Temp\ APPDIR=C:\Program Files (x86)\Beta\MyApp LAUNCH_AFTER_INSTALLATION= REBOOT=ReallySuppress CURRENTDIRECTORY=E:\Downloads CLIENTUILEVEL=3 CLIENTPROCESSID=14268 
MSI (s) (6C:C8) [12:10:57:477]: PROPERTY CHANGE: Adding APPDIR property. Its value is 'C:\Program Files (x86)\Beta\MyApp'.
MSI (s) (6C!30) [12:10:57:742]: Migrating feature settings from product(s) '{MyGUID}'
MSI (s) (6C!30) [12:10:57:742]: Note: 1: 2609 
Action start 12:10:57: MigrateFeatureStates.
MSI (s) (6C!30) [12:10:57:743]: Product: MyApp -- Error 2609. Attempt to migrate product settings before initialization.

Error 2609. Attempt to migrate product settings before initialization.
MSI (s) (6C!30) [12:10:57:745]: Doing action: AI_SETMIXINSTLOCATION
Action ended 12:10:57: MigrateFeatureStates. Return value 3.
MSI (s) (6C:24) [12:10:57:783]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI7FC5.tmp, Entrypoint: MixedAllUsersInstallLocation
MSI (s) (6C!C8) [12:10:57:797]: PROPERTY CHANGE: Adding AI_UserProgramFiles property. Its value is 'C:\Program Files\'.
Action start 12:10:57: AI_SETMIXINSTLOCATION.
MSI (s) (6C!30) [12:10:57:800]: PROPERTY CHANGE: Deleting APPDIR property. Its current value is 'C:\Program Files (x86)\Beta\MyApp'.
MSI (s) (6C!30) [12:10:57:800]: Doing action: AI_RESTORE_LOCATION
Action ended 12:10:57: AI_SETMIXINSTLOCATION. Return value 1.
Action start 12:10:57: AI_RESTORE_LOCATION.
MSI (s) (6C!30) [12:10:57:826]: Doing action: SET_APPDIR
Action ended 12:10:57: AI_RESTORE_LOCATION. Return value 0.
MSI (s) (6C!30) [12:10:57:827]: PROPERTY CHANGE: Adding APPDIR property. Its value is 'C:\Program Files\MyApp'.
Action start 12:10:57: SET_APPDIR.
As should be evident, AI_SETMIXINSTLOCATION is deleting the APPDIR property obtained from the command line, then AI_RESTORE_LOCATION is providing the default path. One strange thing I've noticed is that the log strips the quotations around the values, although I've verified in the code that they're being passed

Code: Select all

"APPDIR=\"" + installdir + "\" " + 
This is not the desired behaviour... absolutely nothing should override the command line in a silent installation (the path is passed from our custom bootstrapper).

Also of note, the enigmatic Error 2609 which in this case has not prevented the installation from completing. I believe it means that it's trying to read from an uninitialized property, but cannot be sure.

I'm using Version 12.0 Build 63246 so it's possible that this has been addressed in a more recent version of Advanced Installer, but I would love to avoid upgrading if it hasn't as it takes our build machine offline to do so.

Curiously, with a minimal .aip, I get the following in the logs:

Code: Select all

Action start 10:47:11: AI_SETMIXINSTLOCATION.
MSI (s) (1C:90) [10:47:11:290]: Skipping action: AI_RESTORE_LOCATION (condition is false)
MSI (s) (1C:90) [10:47:11:290]: Skipping action: SET_APPDIR (condition is false)
MSI (s) (1C:90) [10:47:11:290]: Doing action: SET_SHORTCUTDIR
Action ended 10:47:11: AI_SETMIXINSTLOCATION. Return value 1.
I've attached the minimal .aip which behaves as expected. I'll have to e-mail my .aip and logs to support, judging by that.
Attachments
setup.aip
This does what I would expect and leaves the command line APPDIR intact.
(11.53 KiB) Downloaded 396 times
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Command Line APPDIR being overwritten

Hello Adam,

Please note this happens because your setup project is built as a 64-bit package type (check the "Package Type" option from "install Parameters" page). Therefore, you cannot set the APPDIR property to a 32-bit installation path. Since you are using a "Per-machine if user is administrator, per-user otherwise" installation type the APPDIR will have a default value including the "AI_UserProgramFiles" property which will be resolved to a 64-bit path at install time.

Regarding your attached minimal .aip, the APPDIR property is not overwritten because this project uses a 32-bit package type.

If you have any questions let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
adamdc78
Posts: 76
Joined: Wed Mar 19, 2014 7:42 pm

Re: Command Line APPDIR being overwritten

It turns out that this was actually being caused by incorrect logic in my MSI. Instead of trying to use a new parameter (INSTALL_PER_USER) I'm now setting ALLUSERS="" and MSIINSTALLPERUSER="1" based on the detected version of Windows Installer. APPDIR passed by command line is no longer being overwritten.

64-bit apps can most assuredly be installed in a 32-bit path, although they really shouldn't be (our application used to be a 32-bit-only application and users who've been upgrading since then tend to have %PROGRAMFILES(X86)% as their installation directories).
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Command Line APPDIR being overwritten

Thank you for the follow up.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”