# Doing a small update or minor upgrade in MSI? Use MSIENFORCEUPGRADECOMPONENTRULES.

This little tip for those of you trying to do a small update or minor upgrade has been sitting in my "to blog" box for a long while.  If you are developing a small update or minor upgrade for your MSI product, I encourage you to set the MSIENFORCEUPGRADECOMPONENTRULES Property to "1".  For example:

msiexec /fvomus path\to\minor\upgrade\product.msi REINSTALL=ALL
REINSTALLMODE=vomus MSIENFORCEUPGRADECOMPONENTRULES=1 /l*v i.txt

That 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 (i.txt) should be pretty clear about what when wrong.

For quick reference I've pasted the minor upgrade rules from MSDN here:

• 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.

Finally, if you need to do a lot of debugging of your small updates or minor upgrades and get tired of typing in "MSIENFORCEUPGRADECOMPONENTRULES" then you can set the EnforceUpgradeComponentRules policy registry key instead.

Oh, and by the way, this little tip only works if you have MSI 3.0+ on your machine.  Keep on coding, you know I am.

Comment by Chris Eldredge on Monday, March 5, 2007 1:21 PM

Just out of curiosity, does msiexec do anything at all if MSIENFORCEUPGRADECOMPONENTRULES is left out?

Comment by on Tuesday, November 2, 2010 7:45 AM

Chris, not for minor upgrades, no. I expect they made this Property optional to preserve backwards compatibility.

Comment by Mike W on Thursday, January 13, 2011 10:58 AM

Thanks Rob! This tip helped me figure out why my minor upgrades weren't working. I would have been completely lost without it.