How to delete folder prior to install if exists

  • Thread starter Finn Stampe Mikkelsen
  • Start date
F

Finn Stampe Mikkelsen

I have a solution with several projects, where i have added a setup project. this works great for me.

But now i have a situation, where i need my installer to check if the application folder already exists and if so, i need to delete it all of its files and sub-directories..

I have tried with a costum action, but have so far only gotten errors when trying to run the setup. The installer class has been targeted to the same framework and cpu, but i get an error 1001 with an access violation to the costumaction.dll...

Can anybody either direct me to an understandable tutorial og better yet, maybe try to explain with code snippets how to accomplish what i need?

TIA

/Finn
 
F

Finn Stampe Mikkelsen

"rossum" skrev i meddelelsen news:[email protected]...
/Finn
As a general principle you should not delete the old folder until you
are sure that the new folder is correctly installed. You need to be
able to leavy the machine unchanged if the installation fails for any
reason.

One possible way is:

1 Remane the existing folder to a temporary name.
2 Install new solution.
3 Test for correct installation.
4 If installatin succeeded then delete the temporary folder.
5 If the installation failed then delete the new installation folder,
roll back any other changes and rename the temporary folder back to
its original name.

rossum

I've played around with it now and i believe i've found a workable solution. What i needed was to be able to delete 2 residual files
left over from an uninstall of a previous version install of the software. I figured it would be easier to just delete the install
folder prior to install, but i ended up with examining the folders and checking if these 2 files where present. If so, i delete
them..

This seems to work fine. As these files are not needed even if the install fails, i have no problem with them comming back if it
does. I have however placed the actual code to delete the files in the commit section of the CostumInstall, so it should not be a
problem..

Thanks for your input.. ;-)

/Finn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top