Partilhar via


Removal of a component from a feature is not supported

You might observe that files are not being upgraded after applying a small update or a minor upgrade patch. The upgrade log may not show the exact cause of the issue. After investigation, I found some component rule violation in the upgrade package.

To catch the violation to the upgrade component rules you can pass the public property MSIENFORCEUPGRADECOMPONENTRULES (https://msdn.microsoft.com/en-us/library/Aa370093) that will affect any install on the machine. This will cause small and minor updates to fail with either Windows Installer error 2771 if a component is removed from a feature, or error 2772 if the feature tree is rearranged with the exception of adding a new feature as a leaf feature to an existing feature.

For example first install the Target MSI package then run the below command:
msiexec /fvomus Your_Upgrade_Package.msi REINSTALL=ALL REINSTALLMODE=vomus MSIENFORCEUPGRADECOMPONENTRULES=1 /l*vx log.txt

The above command-line tells MSI to update the cached MSI to start the minor upgrade then do a reinstall to actually replace newer files and registry keys. The MSIENFORCEUPGRADECOMPONENTRULES Property will cause the minor upgrade to fail if you violated any of the minor upgrade rules. The log file (log.txt) would show the cause of the issue.

■Remove a component from a feature.
This can also occur if you change the GUID of a component. The component identified by the original GUID appears to be removed and the component as identified by the new GUID appears as a new component.

■Add a new feature to the top or middle of an existing feature tree.
The new feature must be added as a new leaf feature to an existing feature tree.

In the log (log.txt), I found the following information:

MSI (c) (B7:C0) [10:00:00:000]: SELMGR: ComponentId '{1F634567-89CD-ADEF-8179-D4A709CF0DBC}' is registered to feature 'FeatureA', but is not present in the Component table. Removal of components from a feature is not supported!
MSI (c) (B7:C0) [110:00:00:000]: SELMGR: Removal of a component from a feature is not supported

Please note that components can be added to new features - or existing features - but cannot be removed. In order to remove the component or make a change that would otherwise require a change in the component code - which is no different than removing one component and adding another - the ProductCode property must be changed, which constitutes a major upgrade. This applies even with obsolescence and supersedence. If we recall How Patching Works https://blogs.msdn.com/b/heaths/archive/2005/09/12/464047.aspx that when we obsolesce or supersede a previous patch Windows Installer removes the patch transform from the in-memory view of the product. This effectively removes a component from a feature or features and violates upgrade components rules.

As per the MSDN doc https://msdn.microsoft.com/en-us/library/Aa367850 the product code must be changed if any of the following are true for the update:

•Coexisting installations of both original and updated products on the same system must be possible.
•The name of the .msi file has been changed.
•The component code of an existing component has changed.
•A component is removed from an existing feature.
•An existing feature has been made into a child of an existing feature.
•An existing child feature has been removed from its parent feature.

In order to resolve the issue, try one of the steps:
• Don’t remove the component from the existing feature in the upgrade package
• Change the product Code in the upgrade package which would be a major upgrade.