Discussion:
[WiX-users] optionally removing AppData folders created by application, during uninstall
Adam Langley
2008-06-27 04:10:48 UTC
Permalink
Hi guys,



I have been battling with this problem for a while.

I have a .Net application which saves temporary data into
AppData\Roaming\Bookmarks.

This folder should not HAVE to be installed by the MSI as the app will
create it when needed (but I've gotten to the stage of experimentation
where it seems to be easier if it is created by the MSI - the installer
seems to not want to remove folders it didn't create, no matter what I
do).

I want this folder (and all its contents) to be removed at uninstall if
REMOVEBOOKMARKS=1 (I have created a custom dialog with a checkbox that
lets the user selected during uninstall whether or not to delete these
temporary files). If REMOVEBOOKMARKS=0, then I don't want to delete the
folder (or its contents), allowing any later installations to pick up
these files...



My WiX looks something like this:



<Property Id="REMOVEBOOKMARKS" Value="0"/>



<Directory Id="AppDataFolder">

<Directory Id="MyApp" Name="MyApp">

<Component Id="RemoveAppData"
Guid="8C857E65-5EA2-4b0e-BCDA-334F030B1E4A">

<Condition>REMOVEBOOKMARKS = 1</Condition>



<RegistryKey Root="HKCU" Key="Software\MyApp\Uninstall\1">

<RegistryValue Value="MyApp" Type="string" KeyPath="yes"
/>

</RegistryKey>



<CreateFolder />

<RemoveFolder Id="RemoveAppData" On="uninstall" />

<RemoveFile Id="RemoveAppDataFiles" Name="*"
On="uninstall"/>

</Component>

<Directory Id="Bookmarks" Name="Bookmarks">

<Component Id="AddAppDataBookmarks"
Guid="3494B400-3193-4226-878C-2A4EB1B86456" Permanent="yes" >

<Condition>NOT Installed</Condition>



<RegistryKey Root="HKCU" Key="Software\MyApp\Uninstall\3">

<RegistryValue Value="MyApp" Type="string" KeyPath="yes"
/>

</RegistryKey>





<CreateFolder />

</Component>

<Component Id="RemoveAppDataBookmarks"
Guid="3494B400-3193-4226-878C-2A4EB1B86455">

<Condition>Installed AND REMOVEBOOKMARKS = 1</Condition>



<RegistryKey Root="HKCU" Key="Software\MyApp\Uninstall\3">

<RegistryValue Value="MyApp" Type="string" KeyPath="yes"
/>

</RegistryKey>



<!--<CreateFolder />-->

<RemoveFolder Id="RemoveAppDataBookmarks" On="uninstall"/>

<RemoveFile Id="RemoveAppDataBookmarksFiles" Name="*"
On="uninstall"/>

</Component>

</Directory>

</Directory>

</Directory>



The Bookrmarks folder is the one I want to stay behind if
REMOVEBOOKMARKS=0.

It seems, no matter what I do, I can't get it to work. If I specify
"Permanent" on the AddAppDataBookmarks component, the NOTHING will
remove it.

If I DONT specify it, then no matter what I put in the component
conditions, it will ALWAYS be removed...



How do I set up this sort of behaviour?



Thank you in advance...



Adam Langley

Senior Developer

Tel: +64 9 486 9010
Ryan Dunn
2008-06-27 05:13:37 UTC
Permalink
I second this question. I am in the same boat.

Adam,
Do you use the WixUI or some custom UI?/Would you be able to post your code for the UI on uninstall?
----------------------------------------
Date: Fri, 27 Jun 2008 16:10:48 +1200
Subject: [WiX-users] optionally removing AppData folders created by application, during uninstall
Hi guys,
I have been battling with this problem for a while.
I have a .Net application which saves temporary data into
AppData\Roaming\Bookmarks.
This folder should not HAVE to be installed by the MSI as the app will
create it when needed (but I've gotten to the stage of experimentation
where it seems to be easier if it is created by the MSI - the installer
seems to not want to remove folders it didn't create, no matter what I
do).
I want this folder (and all its contents) to be removed at uninstall if
REMOVEBOOKMARKS=1 (I have created a custom dialog with a checkbox that
lets the user selected during uninstall whether or not to delete these
temporary files). If REMOVEBOOKMARKS=0, then I don't want to delete the
folder (or its contents), allowing any later installations to pick up
these files...
Guid="8C857E65-5EA2-4b0e-BCDA-334F030B1E4A">
REMOVEBOOKMARKS = 1
/>
On="uninstall"/>
Guid="3494B400-3193-4226-878C-2A4EB1B86456" Permanent="yes">
NOT Installed
/>
Guid="3494B400-3193-4226-878C-2A4EB1B86455">
Installed AND REMOVEBOOKMARKS = 1
/>
On="uninstall"/>
The Bookrmarks folder is the one I want to stay behind if
REMOVEBOOKMARKS=0.
It seems, no matter what I do, I can't get it to work. If I specify
"Permanent" on the AddAppDataBookmarks component, the NOTHING will
remove it.
If I DONT specify it, then no matter what I put in the component
conditions, it will ALWAYS be removed...
How do I set up this sort of behaviour?
Thank you in advance...
Adam Langley
Senior Developer
Tel: +64 9 486 9010
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
WiX-users mailing list
https://lists.sourceforge.net/lists/listinfo/wix-users
_________________________________________________________________
The i’m Talkathon starts 6/24/08.  For now, give amongst yourselves.
http://www.imtalkathon.com?source=TXT_EML_WLH_LearnMore_GiveAmongst
Adam Langley
2008-06-27 05:31:13 UTC
Permalink
Sure. Its pretty simple - just create your dialog, copy WixUI_Mondo (or one of the other UI sequences if you want), and insert your button publications...
Compare my XML below with WixUI_Mondo.wxs and you'll see what I've changed (and inserted)...

Adam Langley
Senior Developer


<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI Id="UI_Mondo">
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
<TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
<TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />

<Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
<Property Id="WixUI_Mode" Value="Mondo" />

<DialogRef Id="ErrorDlg" />
<DialogRef Id="FatalError" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="MsiRMFilesInUse" />
<DialogRef Id="PrepareDlg" />
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ResumeDlg" />
<DialogRef Id="UserExit" />

<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>

<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>

<Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg" Order="2">LicenseAccepted = "1"</Publish>

<Publish Dialog="SetupTypeDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
<Publish Dialog="SetupTypeDlg" Control="TypicalButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="SetupTypeDlg" Control="CustomButton" Event="NewDialog" Value="CustomizeDlg">1</Publish>
<Publish Dialog="SetupTypeDlg" Control="CompleteButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>

<Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="1">WixUI_InstallMode = "Change"</Publish>
<Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallCustom"</Publish>
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>

<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="1">WixUI_InstallMode = "InstallCustom"</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete"</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="3">WixUI_InstallMode = "Change"</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="RemoveBookmarksDlg" Order="4">WixUI_InstallMode = "Repair" OR WixUI_InstallMode = "Remove"</Publish>

<Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>

<Publish Dialog="MaintenanceTypeDlg" Control="ChangeButton" Event="NewDialog" Value="CustomizeDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="RemoveBookmarksDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="RemoveBookmarksDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>

<Publish Dialog="RemoveBookmarksDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
<Publish Dialog="RemoveBookmarksDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
</UI>

<UIRef Id="WixUI_Common" />
</Fragment>
</Wix> 
 


-----Original Message-----
From: wix-users-***@lists.sourceforge.net [mailto:wix-users-***@lists.sourceforge.net] On Behalf Of Ryan Dunn
Sent: Friday, 27 June 2008 5:14 p.m.
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] optionally removing AppData folders createdby application, during uninstall


I second this question. I am in the same boat.

Adam,
Do you use the WixUI or some custom UI?/Would you be able to post your code for the UI on uninstall?
----------------------------------------
Date: Fri, 27 Jun 2008 16:10:48 +1200
Subject: [WiX-users] optionally removing AppData folders created by application, during uninstall
Hi guys,
I have been battling with this problem for a while.
I have a .Net application which saves temporary data into
AppData\Roaming\Bookmarks.
This folder should not HAVE to be installed by the MSI as the app will
create it when needed (but I've gotten to the stage of experimentation
where it seems to be easier if it is created by the MSI - the installer
seems to not want to remove folders it didn't create, no matter what I
do).
I want this folder (and all its contents) to be removed at uninstall if
REMOVEBOOKMARKS=1 (I have created a custom dialog with a checkbox that
lets the user selected during uninstall whether or not to delete these
temporary files). If REMOVEBOOKMARKS=0, then I don't want to delete the
folder (or its contents), allowing any later installations to pick up
these files...
Guid="8C857E65-5EA2-4b0e-BCDA-334F030B1E4A">
REMOVEBOOKMARKS = 1
/>
On="uninstall"/>
Guid="3494B400-3193-4226-878C-2A4EB1B86456" Permanent="yes">
NOT Installed
/>
Guid="3494B400-3193-4226-878C-2A4EB1B86455">
Installed AND REMOVEBOOKMARKS = 1
/>
On="uninstall"/>
The Bookrmarks folder is the one I want to stay behind if
REMOVEBOOKMARKS=0.
It seems, no matter what I do, I can't get it to work. If I specify
"Permanent" on the AddAppDataBookmarks component, the NOTHING will
remove it.
If I DONT specify it, then no matter what I put in the component
conditions, it will ALWAYS be removed...
How do I set up this sort of behaviour?
Thank you in advance...
Adam Langley
Senior Developer
Tel: +64 9 486 9010
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
WiX-users mailing list
https://lists.sourceforge.net/lists/listinfo/wix-users
_________________________________________________________________
The i'm Talkathon starts 6/24/08.  For now, give amongst yourselves.
http://www.imtalkathon.com?source=TXT_EML_WLH_LearnMore_GiveAmongst
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
Rob Mensching
2008-06-27 06:40:45 UTC
Permalink
Unfortunately, I think you will have to resort to a Custom Action to get the behavior you want. However, rather than delete files, just add temporary records to RemoveFie table for the appropriate Component to do the removal when you want it done. Using temporary records lets the windows installer handle the execution and rollback for you. Far less code. <smile/>

-----Original Message-----
From: wix-users-***@lists.sourceforge.net [mailto:wix-users-***@lists.sourceforge.net] On Behalf Of Adam Langley
Sent: Thursday, June 26, 2008 21:11
To: WiX-***@lists.sourceforge.net
Subject: [WiX-users] optionally removing AppData folders created by application, during uninstall

Hi guys,



I have been battling with this problem for a while.

I have a .Net application which saves temporary data into
AppData\Roaming\Bookmarks.

This folder should not HAVE to be installed by the MSI as the app will
create it when needed (but I've gotten to the stage of experimentation
where it seems to be easier if it is created by the MSI - the installer
seems to not want to remove folders it didn't create, no matter what I
do).

I want this folder (and all its contents) to be removed at uninstall if
REMOVEBOOKMARKS=1 (I have created a custom dialog with a checkbox that
lets the user selected during uninstall whether or not to delete these
temporary files). If REMOVEBOOKMARKS=0, then I don't want to delete the
folder (or its contents), allowing any later installations to pick up
these files...



My WiX looks something like this:



<Property Id="REMOVEBOOKMARKS" Value="0"/>



<Directory Id="AppDataFolder">

<Directory Id="MyApp" Name="MyApp">

<Component Id="RemoveAppData"
Guid="8C857E65-5EA2-4b0e-BCDA-334F030B1E4A">

<Condition>REMOVEBOOKMARKS = 1</Condition>



<RegistryKey Root="HKCU" Key="Software\MyApp\Uninstall\1">

<RegistryValue Value="MyApp" Type="string" KeyPath="yes"
/>

</RegistryKey>



<CreateFolder />

<RemoveFolder Id="RemoveAppData" On="uninstall" />

<RemoveFile Id="RemoveAppDataFiles" Name="*"
On="uninstall"/>

</Component>

<Directory Id="Bookmarks" Name="Bookmarks">

<Component Id="AddAppDataBookmarks"
Guid="3494B400-3193-4226-878C-2A4EB1B86456" Permanent="yes" >

<Condition>NOT Installed</Condition>



<RegistryKey Root="HKCU" Key="Software\MyApp\Uninstall\3">

<RegistryValue Value="MyApp" Type="string" KeyPath="yes"
/>

</RegistryKey>





<CreateFolder />

</Component>

<Component Id="RemoveAppDataBookmarks"
Guid="3494B400-3193-4226-878C-2A4EB1B86455">

<Condition>Installed AND REMOVEBOOKMARKS = 1</Condition>



<RegistryKey Root="HKCU" Key="Software\MyApp\Uninstall\3">

<RegistryValue Value="MyApp" Type="string" KeyPath="yes"
/>

</RegistryKey>



<!--<CreateFolder />-->

<RemoveFolder Id="RemoveAppDataBookmarks" On="uninstall"/>

<RemoveFile Id="RemoveAppDataBookmarksFiles" Name="*"
On="uninstall"/>

</Component>

</Directory>

</Directory>

</Directory>



The Bookrmarks folder is the one I want to stay behind if
REMOVEBOOKMARKS=0.

It seems, no matter what I do, I can't get it to work. If I specify
"Permanent" on the AddAppDataBookmarks component, the NOTHING will
remove it.

If I DONT specify it, then no matter what I put in the component
conditions, it will ALWAYS be removed...



How do I set up this sort of behaviour?



Thank you in advance...



Adam Langley

Senior Developer

Tel: +64 9 486 9010

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
Ryan O'Neill
2008-06-27 07:39:13 UTC
Permalink
I've got most of this custom action already written, but I do the delete
directly as I never managed to figure out linking into the RemoveFile table.
Not that I put that much effort in, I was pretty wiped out after having to
figure a load of C++.

Do you have an example of this Rob? If so, I'll update my CA and release the
source.

-----Original Message-----
From: wix-users-***@lists.sourceforge.net
[mailto:wix-users-***@lists.sourceforge.net] On Behalf Of Rob Mensching
Sent: 27 June 2008 07:41
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] optionally removing AppData folders created by
application, during uninstall

Unfortunately, I think you will have to resort to a Custom Action to get the
behavior you want. However, rather than delete files, just add temporary
records to RemoveFie table for the appropriate Component to do the removal
when you want it done. Using temporary records lets the windows installer
handle the execution and rollback for you. Far less code. <smile/>

-----Original Message-----
From: wix-users-***@lists.sourceforge.net
[mailto:wix-users-***@lists.sourceforge.net] On Behalf Of Adam Langley
Sent: Thursday, June 26, 2008 21:11
To: WiX-***@lists.sourceforge.net
Subject: [WiX-users] optionally removing AppData folders created by
application, during uninstall

Hi guys,



I have been battling with this problem for a while.

I have a .Net application which saves temporary data into
AppData\Roaming\Bookmarks.

This folder should not HAVE to be installed by the MSI as the app will
create it when needed (but I've gotten to the stage of experimentation
where it seems to be easier if it is created by the MSI - the installer
seems to not want to remove folders it didn't create, no matter what I
do).

I want this folder (and all its contents) to be removed at uninstall if
REMOVEBOOKMARKS=1 (I have created a custom dialog with a checkbox that
lets the user selected during uninstall whether or not to delete these
temporary files). If REMOVEBOOKMARKS=0, then I don't want to delete the
folder (or its contents), allowing any later installations to pick up
these files...



My WiX looks something like this:



<Property Id="REMOVEBOOKMARKS" Value="0"/>



<Directory Id="AppDataFolder">

<Directory Id="MyApp" Name="MyApp">

<Component Id="RemoveAppData"
Guid="8C857E65-5EA2-4b0e-BCDA-334F030B1E4A">

<Condition>REMOVEBOOKMARKS = 1</Condition>



<RegistryKey Root="HKCU" Key="Software\MyApp\Uninstall\1">

<RegistryValue Value="MyApp" Type="string" KeyPath="yes"
/>

</RegistryKey>



<CreateFolder />

<RemoveFolder Id="RemoveAppData" On="uninstall" />

<RemoveFile Id="RemoveAppDataFiles" Name="*"
On="uninstall"/>

</Component>

<Directory Id="Bookmarks" Name="Bookmarks">

<Component Id="AddAppDataBookmarks"
Guid="3494B400-3193-4226-878C-2A4EB1B86456" Permanent="yes" >

<Condition>NOT Installed</Condition>



<RegistryKey Root="HKCU" Key="Software\MyApp\Uninstall\3">

<RegistryValue Value="MyApp" Type="string" KeyPath="yes"
/>

</RegistryKey>





<CreateFolder />

</Component>

<Component Id="RemoveAppDataBookmarks"
Guid="3494B400-3193-4226-878C-2A4EB1B86455">

<Condition>Installed AND REMOVEBOOKMARKS = 1</Condition>



<RegistryKey Root="HKCU" Key="Software\MyApp\Uninstall\3">

<RegistryValue Value="MyApp" Type="string" KeyPath="yes"
/>

</RegistryKey>



<!--<CreateFolder />-->

<RemoveFolder Id="RemoveAppDataBookmarks" On="uninstall"/>

<RemoveFile Id="RemoveAppDataBookmarksFiles" Name="*"
On="uninstall"/>

</Component>

</Directory>

</Directory>

</Directory>



The Bookrmarks folder is the one I want to stay behind if
REMOVEBOOKMARKS=0.

It seems, no matter what I do, I can't get it to work. If I specify
"Permanent" on the AddAppDataBookmarks component, the NOTHING will
remove it.

If I DONT specify it, then no matter what I put in the component
conditions, it will ALWAYS be removed...



How do I set up this sort of behaviour?



Thank you in advance...



Adam Langley

Senior Developer

Tel: +64 9 486 9010

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
WiX-users mailing list
WiX-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
WiX-users mailing list
WiX-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users
No virus found in this incoming message.
Checked by AVG.
Version: 8.0.101 / Virus Database: 270.4.1/1521 - Release Date: 26/06/2008
11:20
Rob Mensching
2008-06-27 17:11:24 UTC
Permalink
1. There is a WcaAddTempRecord(). That will do most of the work.

2. netshortcuts.cpp uses it for CreateFolder, that's pretty similar.

-----Original Message-----
From: wix-users-***@lists.sourceforge.net [mailto:wix-users-***@lists.sourceforge.net] On Behalf Of Ryan O'Neill
Sent: Friday, June 27, 2008 00:39
To: 'General discussion for Windows Installer XML toolset.'
Subject: Re: [WiX-users] optionally removing AppData folders created by application, during uninstall

I've got most of this custom action already written, but I do the delete
directly as I never managed to figure out linking into the RemoveFile table.
Not that I put that much effort in, I was pretty wiped out after having to
figure a load of C++.

Do you have an example of this Rob? If so, I'll update my CA and release the
source.

-----Original Message-----
From: wix-users-***@lists.sourceforge.net
[mailto:wix-users-***@lists.sourceforge.net] On Behalf Of Rob Mensching
Sent: 27 June 2008 07:41
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] optionally removing AppData folders created by
application, during uninstall

Unfortunately, I think you will have to resort to a Custom Action to get the
behavior you want. However, rather than delete files, just add temporary
records to RemoveFie table for the appropriate Component to do the removal
when you want it done. Using temporary records lets the windows installer
handle the execution and rollback for you. Far less code. <smile/>

-----Original Message-----
From: wix-users-***@lists.sourceforge.net
[mailto:wix-users-***@lists.sourceforge.net] On Behalf Of Adam Langley
Sent: Thursday, June 26, 2008 21:11
To: WiX-***@lists.sourceforge.net
Subject: [WiX-users] optionally removing AppData folders created by
application, during uninstall

Hi guys,



I have been battling with this problem for a while.

I have a .Net application which saves temporary data into
AppData\Roaming\Bookmarks.

This folder should not HAVE to be installed by the MSI as the app will
create it when needed (but I've gotten to the stage of experimentation
where it seems to be easier if it is created by the MSI - the installer
seems to not want to remove folders it didn't create, no matter what I
do).

I want this folder (and all its contents) to be removed at uninstall if
REMOVEBOOKMARKS=1 (I have created a custom dialog with a checkbox that
lets the user selected during uninstall whether or not to delete these
temporary files). If REMOVEBOOKMARKS=0, then I don't want to delete the
folder (or its contents), allowing any later installations to pick up
these files...



My WiX looks something like this:



<Property Id="REMOVEBOOKMARKS" Value="0"/>



<Directory Id="AppDataFolder">

<Directory Id="MyApp" Name="MyApp">

<Component Id="RemoveAppData"
Guid="8C857E65-5EA2-4b0e-BCDA-334F030B1E4A">

<Condition>REMOVEBOOKMARKS = 1</Condition>



<RegistryKey Root="HKCU" Key="Software\MyApp\Uninstall\1">

<RegistryValue Value="MyApp" Type="string" KeyPath="yes"
/>

</RegistryKey>



<CreateFolder />

<RemoveFolder Id="RemoveAppData" On="uninstall" />

<RemoveFile Id="RemoveAppDataFiles" Name="*"
On="uninstall"/>

</Component>

<Directory Id="Bookmarks" Name="Bookmarks">

<Component Id="AddAppDataBookmarks"
Guid="3494B400-3193-4226-878C-2A4EB1B86456" Permanent="yes" >

<Condition>NOT Installed</Condition>



<RegistryKey Root="HKCU" Key="Software\MyApp\Uninstall\3">

<RegistryValue Value="MyApp" Type="string" KeyPath="yes"
/>

</RegistryKey>





<CreateFolder />

</Component>

<Component Id="RemoveAppDataBookmarks"
Guid="3494B400-3193-4226-878C-2A4EB1B86455">

<Condition>Installed AND REMOVEBOOKMARKS = 1</Condition>



<RegistryKey Root="HKCU" Key="Software\MyApp\Uninstall\3">

<RegistryValue Value="MyApp" Type="string" KeyPath="yes"
/>

</RegistryKey>



<!--<CreateFolder />-->

<RemoveFolder Id="RemoveAppDataBookmarks" On="uninstall"/>

<RemoveFile Id="RemoveAppDataBookmarksFiles" Name="*"
On="uninstall"/>

</Component>

</Directory>

</Directory>

</Directory>



The Bookrmarks folder is the one I want to stay behind if
REMOVEBOOKMARKS=0.

It seems, no matter what I do, I can't get it to work. If I specify
"Permanent" on the AddAppDataBookmarks component, the NOTHING will
remove it.

If I DONT specify it, then no matter what I put in the component
conditions, it will ALWAYS be removed...



How do I set up this sort of behaviour?



Thank you in advance...



Adam Langley

Senior Developer

Tel: +64 9 486 9010

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
WiX-users mailing list
WiX-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
WiX-users mailing list
WiX-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users
No virus found in this incoming message.
Checked by AVG.
Version: 8.0.101 / Virus Database: 270.4.1/1521 - Release Date: 26/06/2008
11:20


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
Tony Juricic
2008-06-27 15:44:58 UTC
Permalink
This suggestion touches the question I was thinking to ask for a long
time:

I want to perform file/registry key/etc. copy/removal at various times
during install.

I would prefer to use standard actions for that to gain automatic
rollback.

So I have to schedule standard actions to run multiple times and each
time work on a different set of items. However, these items (say files
if file operation) are all in the same table. I was hoping that the
combination of conditions and adding temporary records can help in
selecting subsets from a set of items to be acted upon by the currently
scheduled standard action.

Can we also remove records from the table at runtime?

Are there any other recommendations/best practices/ experiences on how
to use standard action in a more granular/controlled way? *That* is the
best way IMO to minimize uncontrollable effects of custom actions.


-----Original Message-----
From: Rob Mensching [mailto:***@microsoft.com]
Sent: Friday, June 27, 2008 2:41 AM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] optionally removing AppData folders createdby
application, during uninstall

Unfortunately, I think you will have to resort to a Custom Action to get
the behavior you want. However, rather than delete files, just add
temporary records to RemoveFie table for the appropriate Component to do
the removal when you want it done. Using temporary records lets the
windows installer handle the execution and rollback for you. Far less
code. <smile/>

-----Original Message-----
From: wix-users-***@lists.sourceforge.net
[mailto:wix-users-***@lists.sourceforge.net] On Behalf Of Adam
Langley
Sent: Thursday, June 26, 2008 21:11
To: WiX-***@lists.sourceforge.net
Subject: [WiX-users] optionally removing AppData folders created by
application, during uninstall

Hi guys,



I have been battling with this problem for a while.

I have a .Net application which saves temporary data into
AppData\Roaming\Bookmarks.

This folder should not HAVE to be installed by the MSI as the app will
create it when needed (but I've gotten to the stage of experimentation
where it seems to be easier if it is created by the MSI - the installer
seems to not want to remove folders it didn't create, no matter what I
do).

I want this folder (and all its contents) to be removed at uninstall if
REMOVEBOOKMARKS=1 (I have created a custom dialog with a checkbox that
lets the user selected during uninstall whether or not to delete these
temporary files). If REMOVEBOOKMARKS=0, then I don't want to delete the
folder (or its contents), allowing any later installations to pick up
these files...



My WiX looks something like this:



<Property Id="REMOVEBOOKMARKS" Value="0"/>



<Directory Id="AppDataFolder">

<Directory Id="MyApp" Name="MyApp">

<Component Id="RemoveAppData"
Guid="8C857E65-5EA2-4b0e-BCDA-334F030B1E4A">

<Condition>REMOVEBOOKMARKS = 1</Condition>



<RegistryKey Root="HKCU" Key="Software\MyApp\Uninstall\1">

<RegistryValue Value="MyApp" Type="string" KeyPath="yes"
/>

</RegistryKey>



<CreateFolder />

<RemoveFolder Id="RemoveAppData" On="uninstall" />

<RemoveFile Id="RemoveAppDataFiles" Name="*"
On="uninstall"/>

</Component>

<Directory Id="Bookmarks" Name="Bookmarks">

<Component Id="AddAppDataBookmarks"
Guid="3494B400-3193-4226-878C-2A4EB1B86456" Permanent="yes" >

<Condition>NOT Installed</Condition>



<RegistryKey Root="HKCU" Key="Software\MyApp\Uninstall\3">

<RegistryValue Value="MyApp" Type="string" KeyPath="yes"
/>

</RegistryKey>





<CreateFolder />

</Component>

<Component Id="RemoveAppDataBookmarks"
Guid="3494B400-3193-4226-878C-2A4EB1B86455">

<Condition>Installed AND REMOVEBOOKMARKS = 1</Condition>



<RegistryKey Root="HKCU" Key="Software\MyApp\Uninstall\3">

<RegistryValue Value="MyApp" Type="string" KeyPath="yes"
/>

</RegistryKey>



<!--<CreateFolder />-->

<RemoveFolder Id="RemoveAppDataBookmarks" On="uninstall"/>

<RemoveFile Id="RemoveAppDataBookmarksFiles" Name="*"
On="uninstall"/>

</Component>

</Directory>

</Directory>

</Directory>



The Bookrmarks folder is the one I want to stay behind if
REMOVEBOOKMARKS=0.

It seems, no matter what I do, I can't get it to work. If I specify
"Permanent" on the AddAppDataBookmarks component, the NOTHING will
remove it.

If I DONT specify it, then no matter what I put in the component
conditions, it will ALWAYS be removed...



How do I set up this sort of behaviour?



Thank you in advance...



Adam Langley

Senior Developer

Tel: +64 9 486 9010

------------------------------------------------------------------------
-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
Rob Mensching
2008-06-27 17:16:03 UTC
Permalink
Windows Installer doesn't work that way. It executes all of the rows in a particular table in bulk.

-----Original Message-----
From: wix-users-***@lists.sourceforge.net [mailto:wix-users-***@lists.sourceforge.net] On Behalf Of Tony Juricic
Sent: Friday, June 27, 2008 08:45
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] optionally removing AppData folders createdby application, during uninstall

This suggestion touches the question I was thinking to ask for a long
time:

I want to perform file/registry key/etc. copy/removal at various times
during install.

I would prefer to use standard actions for that to gain automatic
rollback.

So I have to schedule standard actions to run multiple times and each
time work on a different set of items. However, these items (say files
if file operation) are all in the same table. I was hoping that the
combination of conditions and adding temporary records can help in
selecting subsets from a set of items to be acted upon by the currently
scheduled standard action.

Can we also remove records from the table at runtime?

Are there any other recommendations/best practices/ experiences on how
to use standard action in a more granular/controlled way? *That* is the
best way IMO to minimize uncontrollable effects of custom actions.


-----Original Message-----
From: Rob Mensching [mailto:***@microsoft.com]
Sent: Friday, June 27, 2008 2:41 AM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] optionally removing AppData folders createdby
application, during uninstall

Unfortunately, I think you will have to resort to a Custom Action to get
the behavior you want. However, rather than delete files, just add
temporary records to RemoveFie table for the appropriate Component to do
the removal when you want it done. Using temporary records lets the
windows installer handle the execution and rollback for you. Far less
code. <smile/>

-----Original Message-----
From: wix-users-***@lists.sourceforge.net
[mailto:wix-users-***@lists.sourceforge.net] On Behalf Of Adam
Langley
Sent: Thursday, June 26, 2008 21:11
To: WiX-***@lists.sourceforge.net
Subject: [WiX-users] optionally removing AppData folders created by
application, during uninstall

Hi guys,



I have been battling with this problem for a while.

I have a .Net application which saves temporary data into
AppData\Roaming\Bookmarks.

This folder should not HAVE to be installed by the MSI as the app will
create it when needed (but I've gotten to the stage of experimentation
where it seems to be easier if it is created by the MSI - the installer
seems to not want to remove folders it didn't create, no matter what I
do).

I want this folder (and all its contents) to be removed at uninstall if
REMOVEBOOKMARKS=1 (I have created a custom dialog with a checkbox that
lets the user selected during uninstall whether or not to delete these
temporary files). If REMOVEBOOKMARKS=0, then I don't want to delete the
folder (or its contents), allowing any later installations to pick up
these files...



My WiX looks something like this:



<Property Id="REMOVEBOOKMARKS" Value="0"/>



<Directory Id="AppDataFolder">

<Directory Id="MyApp" Name="MyApp">

<Component Id="RemoveAppData"
Guid="8C857E65-5EA2-4b0e-BCDA-334F030B1E4A">

<Condition>REMOVEBOOKMARKS = 1</Condition>



<RegistryKey Root="HKCU" Key="Software\MyApp\Uninstall\1">

<RegistryValue Value="MyApp" Type="string" KeyPath="yes"
/>

</RegistryKey>



<CreateFolder />

<RemoveFolder Id="RemoveAppData" On="uninstall" />

<RemoveFile Id="RemoveAppDataFiles" Name="*"
On="uninstall"/>

</Component>

<Directory Id="Bookmarks" Name="Bookmarks">

<Component Id="AddAppDataBookmarks"
Guid="3494B400-3193-4226-878C-2A4EB1B86456" Permanent="yes" >

<Condition>NOT Installed</Condition>



<RegistryKey Root="HKCU" Key="Software\MyApp\Uninstall\3">

<RegistryValue Value="MyApp" Type="string" KeyPath="yes"
/>

</RegistryKey>





<CreateFolder />

</Component>

<Component Id="RemoveAppDataBookmarks"
Guid="3494B400-3193-4226-878C-2A4EB1B86455">

<Condition>Installed AND REMOVEBOOKMARKS = 1</Condition>



<RegistryKey Root="HKCU" Key="Software\MyApp\Uninstall\3">

<RegistryValue Value="MyApp" Type="string" KeyPath="yes"
/>

</RegistryKey>



<!--<CreateFolder />-->

<RemoveFolder Id="RemoveAppDataBookmarks" On="uninstall"/>

<RemoveFile Id="RemoveAppDataBookmarksFiles" Name="*"
On="uninstall"/>

</Component>

</Directory>

</Directory>

</Directory>



The Bookrmarks folder is the one I want to stay behind if
REMOVEBOOKMARKS=0.

It seems, no matter what I do, I can't get it to work. If I specify
"Permanent" on the AddAppDataBookmarks component, the NOTHING will
remove it.

If I DONT specify it, then no matter what I put in the component
conditions, it will ALWAYS be removed...



How do I set up this sort of behaviour?



Thank you in advance...



Adam Langley

Senior Developer

Tel: +64 9 486 9010

------------------------------------------------------------------------
-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
WiX-users mailing list
WiX-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users




-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php

Loading...