Package 1 consists of program X and data file f1.
Package 2 consists of program X and data file f2.
Package 3 consists of program X and data file f3.
etc.
As time goes by, additional packages may be added.
A user may install several packages, in which case program X is installed only once, but the respective data files are installed as needed.
When a package is uninstalled, it must check if it is the only installed package, and if that it the case, it uninstalls program X. But if one of the other packages is still installed, program X must be left in place.
I accomplish this thus: Each package considers X a prerequisite and installs it if needed. Then, each package creates an entry in the registry. Package 1 creates entry E1, package 2 creates entry E2, etc. When uninstalling a package, it checks for the presence of any of these registry entries, and if it finds none, it uninstalls program X. I do this in a custom action under InstallFinalize.
But as I don't know how many packages I may create in the future, I need to be on the safe side. Therefore my packages check for any of 12 possible registry entries.
In order to accomplish this, I need to create an execution condition under Custom Actions. The condition looks like this:
Code: Select all
(REMOVE="ALL") AND (NOT FEATURE_01) AND (NOT FEATURE_02) AND (NOT FEATURE_03) AND (NOT FEATURE_04) AND (NOT FEATURE_05) AND (NOT FEATURE_06) AND (NOT FEATURE_07) AND (NOT FEATURE_08) AND (NOT FEATURE_09) AND (NOT FEATURE_10) AND (NOT FEATURE_11) AND (NOT FEATURE_12) AND (NOT UPGRADINGPRODUCTCODE)My first problem is this: This solution seems to me to be very clumsy. And if I ever create a 13th package, I'm in trouble. Is there a better way to do this?
My second problem is this: The above condition is 298 characters long. But Advanced Installer will not let me enter a condition that contains more that 256 characters. Using a text editor, I can edit the .aip file to contain the very long condition, but is that safe? (AI doesn't complain about finding a long condition in the .aip file)
Of course, I can replace "FEATURE_05" with "F5" to reduce the size of the string; but I guess my main worry is that there is some limit to the allowed complexity of the condition.
--
Claus
FOLLOW US
Get the latest news in Application Packaging