If an action is built-in, it is usually better to use it because it has been
tested in all scenarios (install, upgrade, repair, removal, patching, patch
removal, replace one feature with another one, etc.) than it is to replicate
the built-in action's action in your own custom action (where all that
testing becomes much more expensive).

I suspect the problem with your attempt is that it was not a deferred
action. Immediate actions are never part of the elevated script.

RemoveFile and RemoveFolder both take wildcards (they translate into rows in
the Windows Installer's "RemoveFile" table). The easiest wildcard is to set
@Name to "*". If the file removal eliminates all files in that folder, the
folder is automatically removed (even if you only use the RemoveFile
element).

If you know how many folders that the installer doesn't "know about" you
could enumerate them into properties that you pass to the RemoveFile
element's "Property" attribute. If there is no way of knowing, or if it is a
complex tree, use Bob's "Semi-Custom Actions" technique
(http://www.joyofsetup.com/2007/07/01/semi-custom-actions/) to populate the
RemoveFile table with additional rows at runtime (if you set them right,
just run it all the time and it will do its thing just when it should). Then
you don't have to be testing a deferred custom action (with all the grief
that entails).

-----Original Message-----
From: Harvey, John Ctr USAF Warfighter's Edge
[mailto:john.har...@wedge.hpc.mil] 
Sent: Friday, February 19, 2010 1:40 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Deleting non-installed files on uninstall

RemoveFile does work and it is allowed. Why is this? Is there something
RemoveFile is doing that I can emulate? Or is there a way to have
RemoveFolder work with a non-empty folder?

John Harvey


-----Original Message-----
From: Harvey, John Ctr USAF Warfighter's Edge
[mailto:john.har...@wedge.hpc.mil] 
Sent: Friday, February 19, 2010 2:07 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Deleting non-installed files on uninstall

Impersonate="no" does not seem to work ("yes" doesn't do it either).

I am not using RemoveFile/RemoveFolder because I took a more bazooka
approach. I couldn't find a wildcard for RemoveFolder and I thought my
custom action could get rid of folders that the installer didn't know about.

John Harvey

-----Original Message-----
From: Wilson, Phil [mailto:phil.wil...@invensys.com] 
Sent: Friday, February 19, 2010 12:00 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Deleting non-installed files on uninstall

What's the impersonation setting for the custom action?

And there is a RemoveFile element in WiX that will do this kind of thing
without you writing code. 

Phil Wilson 

-----Original Message-----
From: Harvey, John Ctr USAF Warfighter's Edge
[mailto:john.har...@wedge.hpc.mil] 
Sent: Friday, February 19, 2010 10:06 AM
To: General discussion for Windows Installer XML toolset.
Subject: [WiX-users] Deleting non-installed files on uninstall

I have a requirement that for an uninstall, all files for the product are
removed. Not only do I need to delete files installed by my installer, but I
need to delete any other file that may have showed up while the product was
being used. So, I have a custom action that deletes remaining files after
the uninstall removes files.

On Vista, I have problems with deleting files from the Program Files folder.
During the install I get the UAC dialog where I click Allow. In the log, I
get an access denied message.:

System.UnauthorizedAccessException: Access to the path 'app.config' is
denied.
   at System.IO.Directory.DeleteHelper(String fullPath, String userPath,
Boolean recursive)
   at System.IO.Directory.Delete(String fullPath, String userPath, Boolean
recursive)
   at Microsoft.VisualBasic.FileIO.FileSystem.DeleteDirectoryInternal(String
directory, DeleteDirectoryOption onDirectoryNotEmpty, UIOptionInternal
showUI, RecycleOption recycle, UICancelOption onUserCancel)
   at
Microsoft.VisualBasic.MyServices.FileSystemProxy.DeleteDirectory(String
directory, DeleteDirectoryOption onDirectoryNotEmpty)
   at WEdge.Client.Setup.CA.InstallSequenceCustomActions.RemoveFolder(String
folderToRemove, Session session)

The custom action is VB and is using the following:
My.Computer.FileSystem.DeleteDirectory(folderToRemove,
FileIO.DeleteDirectoryOption.DeleteAllContents)

If I start a CMD prompt using Run As Administrator and then run the
uninstall from the command line, it works. However, I can't find a way to
use Run As for the control panel or Programs and Features.

Any suggestions?

John Harvey

----------------------------------------------------------------------------
--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


*** Confidentiality Notice: This e-mail, including any associated or
attached files, is intended solely for the individual or entity to which it
is addressed. This e-mail is confidential and may well also be legally
privileged. If you have received it in error, you are on notice of its
status. Please notify the sender immediately by reply e-mail and then delete
this message from your system. Please do not copy it or use it for any
purposes, or disclose its contents to any other person. This email comes
from a division of the Invensys Group, owned by Invensys plc, which is a
company registered in England and Wales with its registered office at
Portland House, Bressenden Place, London, SW1E 5BF (Registered number
166023). For a list of European legal entities within the Invensys Group,
please go to
http://www.invensys.com/legal/default.asp?top_nav_id=77&nav_id=80&prev_id=77
. You may contact Invensys plc on +44 (0)20 7821 3848 or e-mail
inet.hqhelpd...@invensys.com. This e-mail and any attachments thereto may be
subject to the terms of any agreements between Invensys (and/or its
subsidiaries and affiliates) and the recipient (and/or its subsidiaries and
affiliates).



----------------------------------------------------------------------------
--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

----------------------------------------------------------------------------
--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

----------------------------------------------------------------------------
--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to