views:

49

answers:

2

I am creating MSI installer via VS 2008. I try to delete the temp folder at the end of the installation. That temp folder is created by my installer to hold some batch files for database creation. It always show other process is access it and doesn't allow my code to delete it. I have called the Close() of that access process. I have put sleep before the code to delete it. Nothing helpful.

Do you have any idea how I can delete it at the end of the installation?

thanks,

A: 

Did you try Filemon to see who is accessing the temp folder when delete is called on the folder? Its better you use the system temp folder path

System.Environment.GetEnvironmentVariable("TEMP")

you need not worry about cleaning it up.

Vinay B R
A: 

I can think of creating a batch file in the temp folder to run which runs as the last step. You put a pause in it by using ping (http://www.robvanderwoude.com/wait.php) and then after a few seconds (that installer has exited) delete the folder by using parameter passed:

PING 1.1.1.1 -n 1 -w 60000 >NUL
rd "%1"

This is really a hack. It is better to root out what locks your folder.

Aliostad