BrianRHobbs
Posts: 20
Joined: Tue Jun 24, 2008 11:13 am

Deleting folders that contain runtime generated files

Hi,

I know this has been posted before, but I've not been able to find a scenario that works. So, my application runs in eclipse, which at runtime, generates a number of cached files in a sub-folder of the installation folder. We actually create the sub-folder (and place a single file into it) as part of the installation, so the folder is explicitly referred to by AI

Now, when I uninstall it leaves these files behind (as it didn't install them). This is not ideal for me, so I've got a simple EXE that I try and execute that will delete a file/folder (I can't use VB Script as some of our clients disable scripting on their PCs), but I can't for the life of me work out where in the standard action hierarchy to put it? I've tried a number of scenarios, but I can't get it to to work.

I've attached a zip example of the problem - to reproduce, compile & run the MSI. then create a text file (can be empty) in the "config" sub folder. Then uninstall - the file remains.

So, does anyone have any suggestions / pointers as to which standard action I can use?

Thanks in advance,
Brian
Attachments
test.zip
(61.15 KiB) Downloaded 460 times
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Deleting folders that contain runtime generated files

Hi Brian,

Please try scheduling your custom action under the "InstallExecuteSequence" -> "InstallFinalize" standard action. This way it will be executed at the end of the uninstall process.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
BrianRHobbs
Posts: 20
Joined: Tue Jun 24, 2008 11:13 am

Re: Deleting folders that contain runtime generated files

Thanks Cosmin, I'll give that a try. While I'm trying, though - InstallFinalize won't let me select "Deferred with no impersonation" - from my experiences so far, won't that cause me problems on a vista pc?

Thanks,
Brian
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Deleting folders that contain runtime generated files

Hi Brian,

Yes, on Vista custom actions which affect the system should run without impersonation. You can schedule your custom action under the "InstallExecuteSequence" -> "InstallIIS" standard action. This way the custom action can run without impersonation at the end of the uninstall.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
BrianRHobbs
Posts: 20
Joined: Tue Jun 24, 2008 11:13 am

Re: Deleting folders that contain runtime generated files

Excellent! Thanks for that.

Brian
canhuth
Posts: 241
Joined: Thu Jun 19, 2008 9:03 am

Re: Deleting folders that contain runtime generated files

BrianRHobbs wrote:...(I can't use VB Script as some of our clients disable scripting on their PCs)...
Hello Brian, Cosmin.

Cosmin, can you say something about disabling scripting? Can this really be done, is it an actual risk?

Is it more advisable to use another scripting application/engine (writing such stuff in C++ is not an option for us because it is not cost-effective - for us)?



With best regards

Clemens Anhuth
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Deleting folders that contain runtime generated files

Hi Clemens,
can you say something about disabling scripting? Can this really be done, is it an actual risk?
Scripting can be disabled on a machine. However, this is rarely done, so I'm not sure if its an actual risk.
Is it more advisable to use another scripting application/engine
Microsoft recommends using C or C++ DLL custom actions in installers. However, for developers which do not know C or C++ VBScript is an easy and fast solution (this is why it is very used in installers).

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
canhuth
Posts: 241
Joined: Thu Jun 19, 2008 9:03 am

Re: Deleting folders that contain runtime generated files

Hello Cosmin,

thank you for your reply.

I also read an article from 2004 where Rob Mensching claims to have heard or seen cases of anti-virus software disabling execution of an installer's VBScript/JScript code. I haven't heard about this happening before though.



With best regards

Clemens Anhuth

Return to “Common Problems”