Why can't I patch or uninstall a component without a ComponentId?


Why can't I patch or uninstall a component without a ComponentId?


Check the Windows Installer documentation on Component Table:

A string GUID unique to this component, version, and language. 
Note that the letters of these GUIDs must be uppercase. Utilities such as GUIDGEN can generate GUIDs containing lowercase letters. The lowercase letters must be changed to uppercase to make these valid component code GUIDs.

If this column is null the installer does not register the component and the component cannot be removed or repaired by the installer.  This might be intentionally done if the component is only needed during the installation, such as a custom action that cleans up temporary files or removes an old product. It may also be useful when copying data files to a user's computer that do not need to be registered.

So, I’d say this behavior is documented and is by design.

What’s happening under the hood?

Remember that patching is a form of repair. So, when you have a component which doesn’t have a component ID then that component can not be serviced. The reason for that is when you do not provide a component ID then that component will not be registered. So, when Windows Installer tries to find the state of that component then that component will be unknown to it. Furthermore, the request/action state for that component become no ops (unless you explicitly change the component state via a CA). As a result, the component will not be serviced or its baseline cached.

Even if you use a custom action (CA) to set the component action states to local so that Windows Installer will be forced to service the component, you might end up in scenarios wherein the component might not be serviced per your expectations, because you would have made some false assumptions down the road. Bottom-line is: if you have some valid reason to create a GUID-less component, then use a CA to service/uninstall the component yourself than to trick Windows Installer do the job it isn't designed to do.

[Author: Hemchander Sannidhanam]

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm.