Hi all, I'd like to second this question. Let me reclaim it: I just want to search registry to find an old installed software which didn't use MSI, and then run this uninstaller. So I search the registry: <Property Id='QUERY_REG_CPSW'> <RegistrySearch Id='QueryRegCpsw' Root='HKLM' Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\cpsw_is1' Name='UninstallString' Type='raw' /> </Property> Then I try to run this uninstaller: <CustomAction Id="SetUninstallCpswCmd" Property="ExecUninstallCpswProperty" Value='[QUERY_REG_CPSW]' /> <CustomAction Id="ExecUninstallCpswCmd" Property="ExecUninstallCpswProperty" ExeCommand="/SILENT /KEEPDATA" Return="asyncWait" /> <InstallExecuteSequence> <Custom Action="SetUninstallCpswCmd" After="AppSearch">QUERY_REG_CPSW</Custom> <Custom Action="ExecUninstallCpswCmd" Before="InstallFinalize">QUERY_REG_CPSW And Not Installed</Custom> </InstallExecuteSequence> The result is: nothing happened - the uninstaller didn't run. What is wrong with this code above? But if I query 'InstallLocation' for registry. And then "Construct the uninstaller string", it works: <CustomAction Id="SetUninstallCpswCmd" Property="ExecUninstallCpswProperty" Value='[QUERY_REG_CPSW]unins000.exe' /> <CustomAction Id="ExecUninstallCpswCmd" Property="ExecUninstallCpswProperty" ExeCommand="/SILENT /KEEPDATA" Return="asyncWait" /> Why I need to "construct the uninstaller string"? It is already in the "UninstallString" registry, correct? The reason I don't want to "construct this uninstaller string" is, sometimes the uninstaller name is not unins000.exe. It might be unins001 or unins002. I mean they are all in the registry. Why I need to explicitly specify the file name? Many thanks. I'm looking forward your responses. I appreicate it.
________________________________ From: little.forest <little.for...@ymail.com> To: wix-users@lists.sourceforge.net Sent: Tuesday, August 18, 2009 4:06:24 PM Subject: [WiX-users] WiX 3.0: Custom Action Type 50 - Read registry to uninstall the previous version of software Hi all, I'm having a problem with Custom Action Type 50 in WiX 3.0. We're using the version 3.0.4805.0. Background: =========== We'd like to uninstall the old version of our software when installing the new version. The old version software's installer was made by using Inno Setup. What we need to do is really simple: Look for the registry at "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\cpsoftware_is1" to find out the "UninstallString". This string is something like "C:\Program Files\cpsoftware\unins000.exe" Then run this uninstaller with the parameters like "/silent /keepdata" Our code: ========= #1. Firstly, I thought we can do this below, but it didn't work: <Property Id='QUERY_REG_CPSW'> <RegistrySearch Id='QueryRegCpsw' Root='HKLM' Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\cpsw_is1' Name='UninstallString' Type='raw' /> </Property> <CustomAction Id="ExecUninstallCpswCmd" Property="QUERY_REG_CPSW" ExeCommand="/SILENT /KEEPDATA" Return="asyncWait" /> <InstallExecuteSequence> <Custom Action="ExecUninstallCpswCmd" Before="InstallFinalize">QUERY_REG_CPSW And Not Installed</Custom> </InstallExecuteSequence> #2. Then, I googled and someone said "you need to set property for type 50 custom action". Then I tried this which still didn't work: <Property Id='QUERY_REG_CPSW'> <RegistrySearch Id='QueryRegCpsw' Root='HKLM' Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\cpsw_is1' Name='UninstallString' Type='raw' /> </Property> <CustomAction Id="SetUninstallCpswCmd" Property="ExecUninstallCpswProperty" Value='[QUERY_REG_CPSW]' /> <CustomAction Id="ExecUninstallCpswCmd" Property="ExecUninstallCpswProperty" ExeCommand="/SILENT /KEEPDATA" Return="asyncWait" /> <InstallExecuteSequence> <Custom Action="SetUninstallCpswCmd" After="AppSearch">QUERY_REG_CPSW</Custom> <Custom Action="ExecUninstallCpswCmd" Before="InstallFinalize">QUERY_REG_CPSW And Not Installed</Custom> </InstallExecuteSequence> #3. Finally, I tried another way below. I made 2 changes here: 1). Instead of query "UninstallString" string which includes the full path and the uninstaller name, I query "InstallLocation" which is just the path to the uninstaller. 2). In the property ExecUninstallCpswProperty, I set the value as '[QUERY_REG_CPSW]unins000.exe'. This time, it works - the old software got uninstalled during installing the new software. <Property Id='QUERY_REG_CPSW'> <RegistrySearch Id='QueryRegCpsw' Root='HKLM' Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\cpsw_is1' Name='InstallLocation' Type='raw' /> </Property> <CustomAction Id="SetUninstallCpswCmd" Property="ExecUninstallCpswProperty" Value='[QUERY_REG_CPSW]unins000.exe' /> <CustomAction Id="ExecUninstallCpswCmd" Property="ExecUninstallCpswProperty" ExeCommand="/SILENT /KEEPDATA" Return="asyncWait" /> <InstallExecuteSequence> <Custom Action="SetUninstallCpswCmd" After="AppSearch">QUERY_REG_CPSW</Custom> <Custom Action="ExecUninstallCpswCmd" Before="InstallFinalize">QUERY_REG_CPSW And Not Installed</Custom> </InstallExecuteSequence> Questions: ========== 1. Why the code I posted in #2 case above didn't work? That "UninstallString" does includes the uninstaller path and name. Whey I can't use it directly and give some parameters? What is wrong in the code in #2? 2. In #3 code above, it works. But why I must give the uninstaller name in the property ExecUninstallCpswProperty? The reason that I don't want to explicitly give the uninstaller name is, sometimes the uninstaller name might not be "unins000.exe". Sure, in most of the cases, it is "unins000..exe". But in some cases, it is not. I mean, if we can read the uninstaller path and name from registry, why I have to give the uninstaller name which isn't a sure thing? Am I doing the right thing? Please point me out. Thanks in advance, /Brian __________________________________________________________________ Reclaim your name @ymail.com or @rocketmail.com. Get your new email address now! Go to http://ca.promos.yahoo.com/jacko/ ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users