Hello,
Thank you for the response.
You are always welcome!
I may not completely understand the "Search" feature, but how can I use this to detect that a feature is being removed from an upgrade?
Please allow me to explain this.
Well, first of all, let's start with what an upgrade means. An upgrade basically means the removal of the older version and the installation of the newer version.
Now, you might questions yourself how the search approach works in an upgrade scenario. What makes this work is the fact that the search is performed before the uninstall of the older version. Just for the sake of this example, we can consider the order as it follows:
Search --> Uninstall of the old product --> Install of the newer product
Basically, the search is performed and, if the component is found, it populates the property assigned to it with the value "1". Let's consider the property that stores the value of the search is named
"RESULT_PROPERTY". With that being said, until now, we have the following:
RESULT_PROPERTY = "1"
Now, we will go to the next step. Here, the setup is removed, including your feature.
The next step now is the installation of the newer product. Here, when the moment to install the features come, Windows Installer will verify the condition that you used for your feature and will ask:
Is RESULT_PROPERTY equal to "1"?
It will go and look for the property and will see that it equals to "1". The next step now is to install the feature.
RESULT_PROPERTY = "1" ==> the component exists
the component exists ==> the feature was installed
Hope things are more clear for you now.
Also, here is a step-by-step which you can follow to achieve this (first, in a new created project and after you succeed with that, you can modify your main project):
- first of all, create two text files on the disk, e.g.:
aa.txt &
bb.txt
- open a new Advanced Installer project
- add the aa.txt file in
"Files and Folders" page --> under
"Application Folder"
- go to
"Organization" page and right click on
"Product" -->
"New Feature". Name the feature, for instance,
"FeatureA" and move the
"aa.txt" component under the
"FeatureA" feature.
- build and install this version of your product. Additionally, make sure the file was correctly installed
- now, in the same project, please add the
"bb.txt" file
- in
"Organization" page, create a new feature, e.g.:
"FeatureB". Move the
"bb.txt" component under the
"FeatureB" feature
- select the "aa.txt" component and copy its GUID
- now please go to
"Search" page. Here, please right click on
"Target Computer" -->
"New Extended Search" -->
"Component is installed". Use the earlier copied GUID in this search.
Additionally, please note the name of the property that stores the result of the search. By default, this is named "RESULT_PROPERTY".
- now please go to
"Organization" page and select the
"FeatureB" feature. Under
"Installation Behavior" field, please set the default to
"Not installed" and in the
"Installed if" field, please insert the following:
- now please go to
"Product Details" page and increase the version of your product, e.g.: 1.0.0 --> 1.0.1
- rebuild the project
- in the .AIP, press CTRL + G buttons combination. This will open the folder where the product was built.
- deploy the setup and then check the installation folder again. Now, instead of 1 file (aa.txt), there should be 2 files (aa.txt and bb.txt).
Hope this helps.
Best regards,
Catalin