AppSearch Property and Standard Property with the same name. - Advanced Installer Community

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!

Alastair
Posts: 42
Joined: Tue Jul 14, 2009 9:54 am
Location: UK

AppSearch Property and Standard Property with the same name.

Hi,

I want to supply a value to an Ini File entry during upgrade and clean install. For an upgrade I want to use the results of a search and for a clean install I want to supply the value from a command line parameter. What is the recommended way fo doing this ? My plan was to use the same property name for the search and the parameter but I notice that the search property name is stored in the AppSeearch table but the property to use to receive a command line parameter is stored in the Property table. While the MSI validates ok in Orca, I'm not sure if this method could cause errors due to the need for Windows Installer to resolve a duplicate name.

Example contents of ini file
[MySection]
MyKey=[SEARCH_AND_PARAMETER_PROPERTY]

Will this work, where the property SEARCH_AND_PARAMETER_PROPERTY is used to store the results of a search and the value of a command line parameter ?
Or is there a better way of achieving the same result ?

Thanks,
Alastair
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: AppSearch Property and Standard Property with the same name.

Hi,

You should not use the same property to store the values provided by the command line and by the search, as the search, being executed after the installer takes its command line arguments, will overwrite the value given from the command line. You should instead use different properties to store the values given from command line and search result. To achieve this, follow these steps:
- on the Files and Folders page, in your INI file
- in your INI file, add your Key two times, with the following settings:

Code: Select all

KEY             VALUE             ACTION
MyKey           [MYPARAMETER]     Create or update
MyKey           [MYSEARCH]        Create only if it does not exist
- MYPARAMETER is the property that is being set via the command line
- MYSEARCH is the search result
- if no value is provided via command line, MYPARAMETER will be empty and MYSEARCH will be used as the value for your key instead

You can also achieve your desired result by using Custom Actions like this:
- on the Files and Folders page, in your INI file, add one key with the value [MYVALUE]
- in your Dialogs page, on the WelcomeDlg select the "Next" button
- go to the Published Events tab
- add two new SetProperty events, so that the result will look like this:

Code: Select all

EVENT           ARGUMENT          CONDITION
[MYVALUE]       [MYSEARCH]        AI_INSTALL AND MYSEARCH
[MYVALUE]       [MYPARAMETER]     AI_INSTALL AND MYPARAMETER
NewDialog       [FolderDlg]       AI_INSTALL
- please note that the order of the events should be exactly as shown above.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
Alastair
Posts: 42
Joined: Tue Jul 14, 2009 9:54 am
Location: UK

Re: AppSearch Property and Standard Property with the same name.

Hi,

Many thanks for this.

I used the build facility to exclude searches from clean install builds which would require parameters, and include searches in the upgrade builds which would not use parameters and this seems to work ok. However I appreciate your suggestion which looks like a better solution.

Regards,
Alastair

Return to “Common Problems”