Nico-D
Posts: 63
Joined: Mon Aug 18, 2008 2:34 pm

[feature] - uninstalling a feature with CAs

Hello

I am encountering the following problem: I have a package containing two features at the same level. They are both installed by default.

Install uses a CA for each one (service install), and uninstall is doing the same (service removal). Visit my earlier posts to see why I must use CAs to install/uninstall services.

But if I remove one feature only, it works, but uninstall CA relative to this feature is not launched. And when I completely remove the application (containing only one feature but the CAs for both), it leads to a "Add or Remove Programs: Fatal Error during installation." message.

In order to remove the application, I have to re-install the uninstalled feature, and choose "remove" again for the product. Then, both CAs are launched and the product is completely uninstalled.

Is it possible to avoid this problem and make the feature work?

Regards,
-- Nicolas D.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: [feature] - uninstalling a feature with CAs

Hi Nicolas,
But if I remove one feature only, it works, but uninstall CA relative to this feature is not launched.
Please note that a custom action is launched only if its condition is met. Therefore, if you want to run a custom action only when a feature is removed, you can use the feature action of that feature in the condition of the custom action.

For example, if a feature has the Identifier "MyFeat" the condition can look like this:

Code: Select all

((&MyFeat = 2) AND (!MyFeat = 3))
Please note that in the "Expression" field in the Custom Action Properties page you can use the "..." button to show the Edit Condition dialog. This dialog contains some predefined conditions related to features which may help you.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Nico-D
Posts: 63
Joined: Mon Aug 18, 2008 2:34 pm

Re: [feature] - uninstalling a feature with CAs

Wonderful, Cosmin !
I did not know about this "feature action" button. It works perfectly, although I do not completely understand the notation ((&MyFeature = 2) AND (!MyFeature =3)). I will look in the documentation.

Thanks !
-- Nicolas D.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: [feature] - uninstalling a feature with CAs

Hi,

The feature action represents what the package will do with the feature during installation (install it, remove it etc). A feature action uses the & symbol.
The feature state represents the state of the already installed feature (if its installed or absent). A feature state uses the ! symbol.

For more details about this please see:
http://msdn.microsoft.com/en-us/library ... S.85).aspx
http://msdn.microsoft.com/en-us/library ... S.85).aspx

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”