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
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users