1
votes

We have an msi (created through Visual Studio Setup Project) that registers a COM component. On install everything works fine and at the end the registry contains a key under HKEY_CLASSES_ROOT for the com component referring to the CLSID registry key pointing at the dll.

We have our msi built through a CI environment that builds an incremented version of the msi whenever code changes. If I try to run a higher versioned msi on a machine that already has the product installed the com component registry key is removed. This is bad. If I then run the msi again to repair the installation the key is added back and everything works fine again.

Any ideas on what's happening or how to fix this?

Here's some relevant (I hope) log information from the update:

MSI (s) (20:38) [14:43:42:158]: Executing op:   RegOpenKey(,Key=X.Validation.ValidationInitializationLogger,,BinaryType=0,)
MSI (s) (20:38) [14:43:42:158]: Executing op:   RegAddValue(,Value=X.Validation.ValidationInitializationLogger,)
WriteRegistryValues: Key: \Software\Classes\X.Validation.ValidationInitializationLogger, Name: ,   Value: X.Validation.ValidationInitializationLogger
MSI (s) (20:38) [14:43:42:158]: Executing op: RegOpenKey(,Key=CLSID\{0E5EA3AC-6F32-3071-BB20-  F99DC060C76E}\ProgId,,BinaryType=0,)
MSI (s) (20:38) [14:43:42:158]: Executing op:     RegAddValue(,Value=X.Validation.ValidationInitializationLogger,)
WriteRegistryValues: Key: \Software\Classes\CLSID\{0E5EA3AC-6F32-3071-BB20-F99DC060C76E}\ProgId, Name:  , Value: X.Validation.ValidationInitializationLogger
MSI (s) (20:38) [14:43:42:158]: Executing op: RegOpenKey(,Key=CLSID\{0E5EA3AC-6F32-3071-BB20-  F99DC060C76E}\InprocServer32,,BinaryType=0,)
MSI (s) (20:38) [14:43:42:158]: Executing op: RegAddValue(,Value=mscoree.dll,)
WriteRegistryValues: Key: \Software\Classes\CLSID\{0E5EA3AC-6F32-3071-BB20-  F99DC060C76E}\InprocServer32, Name: , Value: mscoree.dll
MSI (s) (20:38) [14:43:42:174]: Executing op: RegAddValue(Name=Class,Value=X.Validation.ValidationInitializationLogger,)
WriteRegistryValues: Key: \Software\Classes\CLSID\{0E5EA3AC-6F32-3071-BB20-  F99DC060C76E}\InprocServer32, Name: Class, Value: X.Validation.ValidationInitializationLogger
...
MSI (s) (20:EC) [14:43:43:924]: Executing op:   RegRemoveValue(Name=Class,Value=X.Validation.ValidationInitializationLogger,)
RemoveRegistryValues: Key: \Software\Classes\CLSID\{A2C211B7-A4B7-34CB-8996- 98287F881E24}\InprocServer32, Name: Class
MSI (s) (20:EC) [14:43:43:924]: Executing op: RegRemoveValue(Name=ThreadingModel,Value=Both,)
RemoveRegistryValues: Key: \Software\Classes\CLSID\{A2C211B7-A4B7-34CB-8996-    98287F881E24}\InprocServer32, Name: ThreadingModel
MSI (s) (20:EC) [14:43:43:924]: Executing op: RegRemoveValue(Name=CodeBase,Value=    [#_18CD862A59400E9C1978B46E816FB049],)
RemoveRegistryValues: Key: \Software\Classes\CLSID\{A2C211B7-A4B7-34CB-8996-98287F881E24}\InprocServer32, Name: CodeBase
MSI (s) (20:EC) [14:43:43:924]: Executing op:     RegOpenKey(,Key=X.Validation.ValidationInitializationLogger,,BinaryType=0,)
MSI (s) (20:EC) [14:43:43:924]: Executing op:     RegRemoveValue(,Value=X.Validation.ValidationInitializationLogger,)
RemoveRegistryValues: Key: \Software\Classes\X.Validation.ValidationInitializationLogger, Name: 
MSI (s) (20:EC) [14:43:43:924]: Executing op: RegOpenKey(,Key=CLSID\{A2C211B7-A4B7-34CB-8996-98287F881E24}\ProgId,,BinaryType=0,)
MSI (s) (20:EC) [14:43:43:924]: Executing op:     RegRemoveValue(,Value=X.Validation.ValidationInitializationLogger,)
RemoveRegistryValues: Key: \Software\Classes\CLSID\{A2C211B7-A4B7-34CB-8996-98287F881E24}\ProgId, Name: 
MSI (s) (20:EC) [14:43:43:924]: Executing op: RegOpenKey(,Key=CLSID\{A2C211B7-A4B7-34CB-8996-98287F881E24},,BinaryType=0,)
MSI (s) (20:EC) [14:43:43:924]: Executing op:     RegRemoveValue(,Value=X.Validation.ValidationInitializationLogger,)
RemoveRegistryValues: Key: \Software\Classes\CLSID\{A2C211B7-A4B7-34CB-8996-98287F881E24}, Name: 
MSI (s) (20:EC) [14:43:43:924]: Executing op:     RegOpenKey(,Key=X.Validation.ValidationInitializationLogger\CLSID,,BinaryType=0,)
MSI (s) (20:EC) [14:43:43:924]: Executing op: RegRemoveValue(,Value={A2C211B7-A4B7-34CB-8996-98287F881E24},)
RemoveRegistryValues: Key: \Software\Classes\X.Validation.ValidationInitializationLogger\CLSID,     Name: 

It seems like the registry keys are being added and then removed at the end of the update.

3
Anything I can add so that people will be better able to respond?John

3 Answers

1
votes

I've run into the same problem and I've just finished working through it. The intention of my upgrade MSI is to uninstall the old version and reinstall the new version so that the old components are not left behind. Initially, registry entries were getting deleted, much like you're experiencing. To fix this, I've done the following changes manually via Orca.exe:

  • In the Properties table, I've added the key/value pair: REINSTALLMODE = amus
  • In the InstallExecuteSequence table, I modified the Sequence of the RemoveExistingProducts Action to come just before the InstallValidate Action. This is per the advice of Adrian Accinelli from the following thread: MSDN MSI Forum
  • Finally, I checked to make sure the rows in the Upgrade table were correct. I modified it so that the row with ActionProperty = PREVIOUSVERSIONSINSTALLED had the version min set to 1.0.0.0, version max set to the version number of the previous version, and the Attributes set to 768. I modified the row with ActionProperty = NEWERPRODUCTFOUND to have version min set to the version number of your upgrade, version max set to blank, and Attributes set to 258. See here for details of the Attributes column.

As you probably know, Orca is part of the Windows SDK. However, all this can be automated in a post-build event by using Cscript and WiRunSQL.vbs using commands like the following:

Cscript WiRunSQL.vbs foo.msi "INSERT INTO Property (Property.Property, Property.Value) VALUES ('REINSTALLMODE','amus')"

Good luck! Let me know how it goes! -Ken

0
votes

I know you say the MSI is properly versioned, what about the COM component? Is it's FileVersion (AssemblyFileVersion in .NET ) also higher versioned?

0
votes

If you are trying to upgrade you should probably try to use

<RemoveExistingProducts After="InstallFinalize" /> 

(in Wix terms).