Something like this. You can iterate your paths to remove and generate
appropriate elements (C#):

//RemoveFile element
XmlElement removeFileElement = document.CreateElement("RemoveFile");
removeFileElement.SetAttribute("Id", propertyId + "_FILES");
removeFileElement.SetAttribute("Name", "*.*");
removeFileElement.SetAttribute("On", "uninstall");
removeFileElement.SetAttribute("Property", propertyId);

and / or

//RemoveFolder element
XmlElement removeFolderElement = document.CreateElement("RemoveFolder");
removeFolderElement.SetAttribute("Id", propertyId + "_FOLDER");
removeFolderElement.SetAttribute("On", "uninstall");
removeFolderElement.SetAttribute("Property", propertyId);

As a result, you get the wix authoring similar to this:

...
<DirectoryRef Id="Themes">
  <Component Id="RemoveFiles"
Guid="{81B6A3B9-FD37-4ec8-ACC5-7C8AB3B0FF1F}">
     <CreateFolder Directory="Themes" />
     <RemoveFile Id ="CssFiles" Name="*.*" On="uninstall"
Directory="Themes"/>
     <RemoveFile Id="LINES_0_FILES" Name="*.*" On="uninstall"
Property="LINES_0" />
     <RemoveFile Id="LINES_1_FILES" Name="*.*" On="uninstall"
Property="LINES_1" />
     ...
     <RemoveFolder Id="Themes" On ="uninstall"/>
     <RemoveFolder Id="LINES_0_FOLDER" On="uninstall" Property="LINES_0"
/>
     <RemoveFolder Id="LINES_1_FOLDER" On="uninstall" Property="LINES_1"
/>     
     ...
  </Component>
</DirectoryRef>
...

Also, you might be interested in the RemoveFolderEx extension placed on
Wix-contrib resource (http://www.codeplex.com/wixcontrib). But note that
author marked it as medium production quality.


Hope this helps.

-- Yan

-----Original Message-----
From: sandun css [mailto:sandun...@gmail.com] 
Sent: Thursday, February 26, 2009 11:40 AM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Delete folders

Hi Yan,

Can I have some sample code please ?

On Thu, Feb 26, 2009 at 2:35 PM, Yan Sklyarenko <y...@sitecore.net> wrote:

> Nothing predefined, only custom action. BUT, you should not do this -
> instead, create an automation once to generate a wix authoring
> containing all the directories/files to remove, and then include it
into
> your project.
>
> -- Yan
>
> -----Original Message-----
> From: sandun css [mailto:sandun...@gmail.com]
>  Sent: Thursday, February 26, 2009 7:37 AM
> To: General discussion for Windows Installer XML toolset.
> Subject: Re: [WiX-users] Delete folders
>
> I need to delete all the folders exist inside the install directory.
> (without specifing their names)
>
> RemoveFile, RemoveFolder elements need file and folder names to be
> specified.
>
> Is it possible to do this withour specifing the names ?
>
> On Wed, Feb 25, 2009 at 6:42 PM, Yan Sklyarenko <y...@sitecore.net>
wrote:
>
> > MSI supports this via RemoveFile table:
> > http://msdn.microsoft.com/en-us/library/aa371201.aspx.
> > WiX wraps this into RemoveFile and RemoveFolder elements (see docs
on
> > this).
> >
> > -- Yan
> >
> > -----Original Message-----
> > From: sandun css [mailto:sandun...@gmail.com]
> > Sent: Wednesday, February 25, 2009 10:45 AM
> > To: wix-users@lists.sourceforge.net
> > Subject: [WiX-users] Delete folders
> >
> > Hi,
> >
> > When I uninstall my application, all the folders which were created
> > after
> > the installation remains without getting deleted. How can I delete
> those
> > folders?
> >
> > Can't I delete all the folders exist in the Install directory ? If
so,
> > how
> > to do it?
> >
> > Thanks,
> > Sandun
> >
>
------------------------------------------------------------------------
> > ------
> > Open Source Business Conference (OSBC), March 24-25, 2009, San
> > Francisco, CA
> > -OSBC tackles the biggest issue in open source: Open Sourcing the
> > Enterprise
> > -Strategies to boost innovation and cut costs with open source
> > participation
> > -Receive a $600 discount off the registration fee with the source
> code:
> > SFAD
> > http://p.sf.net/sfu/XcvMzF8H
> > _______________________________________________
> > WiX-users mailing list
> > WiX-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wix-users
> >
> >
> >
>
------------------------------------------------------------------------
> ------
> > Open Source Business Conference (OSBC), March 24-25, 2009, San
> Francisco,
> > CA
> > -OSBC tackles the biggest issue in open source: Open Sourcing the
> > Enterprise
> > -Strategies to boost innovation and cut costs with open source
> > participation
> > -Receive a $600 discount off the registration fee with the source
> code:
> > SFAD
> > http://p.sf.net/sfu/XcvMzF8H
> > _______________________________________________
> > WiX-users mailing list
> > WiX-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wix-users
> >
>
------------------------------------------------------------------------
> ------
> Open Source Business Conference (OSBC), March 24-25, 2009, San
> Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the
> Enterprise
> -Strategies to boost innovation and cut costs with open source
> participation
> -Receive a $600 discount off the registration fee with the source
code:
> SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
>
>
------------------------------------------------------------------------
------
> Open Source Business Conference (OSBC), March 24-25, 2009, San
Francisco,
> CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the
> Enterprise
> -Strategies to boost innovation and cut costs with open source
> participation
> -Receive a $600 discount off the registration fee with the source
code:
> SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
------------------------------------------------------------------------
------
Open Source Business Conference (OSBC), March 24-25, 2009, San
Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the
Enterprise
-Strategies to boost innovation and cut costs with open source
participation
-Receive a $600 discount off the registration fee with the source code:
SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to