I have changed my code. But it doesn't work. Please have a look at the code, there may be something wrong with <directory> I think. Do I miss some important things?
<Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="ProgramFilesFolder" Name="PFiles"> <Directory Id=" MyAppFolder" Name=" myappname"> <Directory Id="INSTALLDIR" > <Component Id="Service" Guid="....PRODUCT GUID...."> <RemoveFolder Id="ProgramMenuDir" Directory="ProgramMenuDir" On="uninstall" /> <RemoveFolder Id="INSTALLDIR" Directory="INSTALLDIR" On="uninstall" /> <RegistryKey Root="HKCU" Key="Software\ myappname "> <RegistryValue Value="Uninstall" Type="string" KeyPath="yes" /> </RegistryKey> ... <!-- add the component files --> ... <File .... Vital="yes" /> ... </Component> </Directory> </Directory> </Directory> </Directory> <UI> ... <Dialog .... ... </Dialog> <AdminUISequence> <Show Dialog="FatalError" OnExit="error" /> <Show Dialog="UserExit" OnExit="cancel" /> <Show Dialog="ExitDialog" OnExit="success" /> <Show Dialog="PrepareDlg" Before="CostInitialize"></Show> <Show Dialog="AdminWelcomeDlg" After="CostFinalize" /> <Show Dialog="ProgressDlg" After="AdminWelcomeDlg" /> </AdminUISequence> <InstallUISequence> <Show Dialog="FatalError" OnExit="error" /> <Show Dialog="UserExit" OnExit="cancel" /> <Show Dialog="ExitDialog" OnExit="success" /> <Show Dialog="PrepareDlg" After="LaunchConditions" /> <Show Dialog="WelcomeDlg" After="MigrateFeatureStates">NOT Installed</Show> <Show Dialog="ResumeDlg" After="WelcomeDlg">Installed AND (RESUME OR Preselected)</Show> <Show Dialog="MaintenanceWelcomeDlg" After="ResumeDlg">Installed AND NOT RESUME AND NOT Preselected</Show> <Show Dialog="ProgressDlg" After="MaintenanceWelcomeDlg" /> </InstallUISequence> </UI> <InstallExecuteSequence> <Custom Action= ...... >(NOT Installed)</Custom> <Custom Action="rollback" Before="InstallFinalize"/> <RemoveExistingProducts After="InstallFinalize" /> </InstallExecuteSequence> From: Rob Mensching [mailto:[EMAIL PROTECTED] Date: 2008/11/26 1:42 To: General discussion for Windows Installer XML toolset. Subject: Re: [WiX-users] How can I get the correct INSTALLDIR at the beginning of uninstall? Things *might* also get confused if a CustomAction is modifying the Directory. PS: Directory/@Name="." is the same as not having the Directory/@Name. -----Original Message----- From: Kevin Richardson [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 25, 2008 08:54 To: Jianjun An (Person Consulting) Cc: General discussion for Windows Installer XML toolset. Subject: Re: [WiX-users] How can I get the correct INSTALLDIR at the beginning of uninstall? In that case, something is definitely wrong. Uninstall should work from any install location without your intervention. You had said that we were both doing the same thing, but your directory table is not the same as mine. You have: > <Directory Id="TARGETDIR" Name="SourceDir"> > <Directory Id="ProgramFilesFolder" Name="PFiles"> > <Directory Id="INSTALLDIR" Name="."> > <Directory Id="MyApp" Name=" myappname "> > < File ......... /> > </Directory> > </Directory> > </Directory> > </Directory> I have: > <Directory Id="TARGETDIR" Name="SourceDir"> > <Directory Id="ProgramFilesFolder" Name="Program Files"> > <Directory Id="MyAppFolder" Name="myappname"> > <Directory Id="INSTALLDIR /> > </Directory> > </Directory> > </Directory> Notice that your INSTALLDIR is nested *above* the MyApp folder, and also has a Name attribute. I've never seen this done, and it might be messing with the uninstall. It almost seems like you're defining INSTALLDIR as the Program Files folder. Maybe it's valid... I'm not sure. But you definitely shouldn't have to "tell" Windows Installer where your components were installed in order to remove them. -kevin On Nov 25, 2008, at 2:20 AM, Jianjun An (Person Consulting) wrote: > > The problem is my MSI cannot remove the components if user changed > default install path which I did not save it into registry. > > The context about this problem is in the attachment. > > Thanks ------------------------------------------------------------------------- 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 ------------------------------------------------------------------------- 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