Question : run macro / exe during installation - msi installer

Can we run macros or exe before program installation in installer? Can we check and delete windows folders  (basically to cleanup before the actual installation)?

Am creating the setup installer with standard Visual Studio 'Setup and Deployment'. I have to run some macros to check older software entries. When the user clicks setup.exe ... this cleanup macro has to run. Is it possible?

Any help or ideas is much appreciated. Cheers.
 

Answer : run macro / exe during installation - msi installer

the way MSI infrastructure works is first deploy the files and then do the rest, so if u wish to run some cleanup before even extracting the Msi package, u have few alternatives:
1. extract the files to a backup folder other this the desired installation directory, then perform your cleanup and then copy the binaries to the real installation directory.
2. have a nested msi installers, the outer installer (container) package will contain the actual installer plus an executable/script which will be run by the container installer.
the executable/script will first wait till the container msi finish the installation (since 2 MSI instances cannot run on the same time), then run the cleanup, then install the inner MSI package and finally uninstall the Msi
container.

option #2 sounds complicated and i actually implemented this in my company to support pre/post installation procedures to have the ability to run scripts before installation and after installation (and they can't be part of the Msi package itself).
Random Solutions  
 
programming4us programming4us