BTW, if the registry which storing the install path be deleted by user or some other applications, can the uninstall get the correct install path ?
-----Original Message----- From: Jianjun An (Person Consulting) [mailto:[EMAIL PROTECTED] Sent: 2008/11/25 11:41 To: Kevin Richardson Cc: wix-users@lists.sourceforge.net Subject: Re: [WiX-users] How can I get the correct INSTALLDIR at the beginning of uninstall? Thanks, what I did is same as what you suggested. The difference is yours CA has condition but mine is setting the INSTALLDIR property immediately. I checked some sample code of Wix, and found that some of them do not use registry to store install path and can also get user specified path when uninstalling. How can I do that? I am seeking a way not using registry. -----Original Message----- From: Kevin Richardson [mailto:[EMAIL PROTECTED] Sent: 2008/11/25 0:01 To: Jianjun An (Person Consulting) Cc: wix-users@lists.sourceforge.net Subject: Re: [WiX-users] How can I get the correct INSTALLDIR at the beginning of uninstall? You probably want the directory tree to look like this: > <Directory Id="TARGETDIR" Name="SourceDir"> > <Directory Id="ProgramFilesFolder" Name="Program Files"> > <Directory Id="MyAppFolder" Name="myappname"> > <Directory Id="INSTALLDIR /> > </Directory> > </Directory> > </Directory> This sets INSTALLDIR to be (by default) Program Files\myappname. You shouldn't have to do anything special to uninstall the application. I write INSTALLDIR to the registry to store the path for use later (i.e. during upgrades, instead of using the default directory, it remembers their preference). My INSTALLDIR registry stuff looks like this: <!-- Existing install path --> <Property Id="EXISTINGINSTALLDIR" Secure="yes"> <RegistrySearch Id="Locate_EXISTINGINSTALLDIR" Root="HKLM" Key="SOFTWARE\Company\Product" Name="InstallPath" Type="directory" /> </Property> <!-- custom action specification --> <CustomAction Id="Set_INSTALLDIR" Execute="firstSequence" Property="INSTALLDIR" Value="[EXISTINGINSTALLDIR]" /> <InstallExecuteSequence> ... <Custom Action="Set_INSTALLDIR" After="FileCost"><![CDATA[NOT Installed AND (NOT INSTALLDIR) AND EXISTINGINSTALLDIR]]></Custom> ... </InstallExecuteSequence> <InstallUISequence> ... <Custom Action="Set_INSTALLDIR" After="FileCost"><![CDATA[NOT Installed AND (NOT INSTALLDIR) AND EXISTINGINSTALLDIR]]></Custom> ... </InstallUISequence> -kevin On Nov 24, 2008, at 9:23 AM, [EMAIL PROTECTED] wrote: > Date: Mon, 24 Nov 2008 21:25:05 +0800 > From: "Jianjun An (Person Consulting)" <[EMAIL PROTECTED]> > Subject: [WiX-users] How can I get the correct INSTALLDIR at the > beginning of uninstall? > To: "wix-users@lists.sourceforge.net" > <wix-users@lists.sourceforge.net> > Message-ID: > <[EMAIL PROTECTED] > > > > Content-Type: text/plain; charset="us-ascii" > > Hi: > > I wrote a MSI file to install my application. It can let user select > install path through BrowseDlg. But once user changes the default > install path, it cannot remove any file which the MSI has installed. > > I checked the installation log file. I found that it cannot get the > correct INSTALLDIR at the beginning of uninstall. The path it got > still is the default value "c:\programe files\myappname" > I found an awkward solution: write the INSTALLDIR to registry and > read it when uninstalling. > > Is there any other better solution? > > > A piece of wxs code looks like following: > > <Directory Id="TARGETDIR" Name="SourceDir"> > <Directory Id="ProgramFilesFolder" Name="PFiles"> > <Directory Id="INSTALLDIR" Name="."> > <Directory Id="MyApp" Name=" myappname "> > < File ......... /> > </Directory> > </Directory> > </Directory> > </Directory> > > <Property Id='INSTALLDIR'> > <RegistrySearch Id="PreviousInstallLocationRegistrySearch" > Root="HKLM" Key="SOFTWARE\myappname" > Name="InstallDir" Type="raw"/> > </Property> ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users