0

I have a msi installer wrapped into a DotNetInstaller exe file. Everything works fine but when I try to uninstall it from the Add/Remove window it doesn't run the .exe file but the .msi. I really need the .exe to be run because I'm passing properties' values as uninstall_cmdparameters. Please Help.

Thanks in advance.

p4bl0
  • 11
  • 1
  • 3
  • When your product is installed using the msi package, i am assuming that it creates an entry for itself in the Add/Remove programs applet. To create this entry in the Add/Remove programs applet, a registry entry would be created under HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall (for 32 bit installers) or HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall(for 64 bit installers). Under this registry key, there will be a "Name" called "UninstallString". What is the value associated here? – Kiran Hegde Aug 27 '15 at 06:07
  • It's just: "MsiExec.exe /x[ProducCode]" – p4bl0 Aug 28 '15 at 12:56

1 Answers1

0

OK, after struggling for like 4 days with this bullsh*t, I've finally came up with something.
I run a C# Custom Action before the install finalization and then I update the registry keys in Uninstall[ProductCode]:

string UNINSTALL_REGKEY = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"; string productCode = session["ProductCode"];

Registry.SetValue(UNINSTALL_REGKEY + productCode, "UninstallString", "MsiExec.exe /x " + productCode + " DELFILES=TRUE", RegistryValueKind.String);
Registry.SetValue(UNINSTALL_REGKEY + productCode, "WindowsInstaller", 0, RegistryValueKind.DWord);
(Note: the WindowsInstaller's value must be set to 0 otherwise it won't use the UninstallString's value)

Now when I remove my product from the Add/Remove Programs the uninstallation runs with my modified UninstallString.

Hope it helps to others with the same problem.

p4bl0
  • 11
  • 1
  • 3