I have this problem. I built an installer for my c# solution, that will be placed in a folder with other installation folders and files that are needed to be copied to the installed folder. So that is easy, I just copy them to the folder I create using the folder structure I want by specifying the properties in my visual studio setup project.
Now, I want also that when i run that ‘setup.exe’ that was created by me,certain files from c:/ directory also get deleted (if they were present) from the specific machine on which i am running the setup installer.
I had tried giving command line argument in PostBuildEvent & PreBuildEvent under the properties window of my setup installer project,but its not working. It is deleting those files when i am building the project, rather i want those files to be deleted while running the setup installer file (Setup.exe) which gets creates after project-build.
You’d be able to write code inside a custom action dll which could do this for you.
Bear in mind though you may have permissions issues, depending on what privileges the account running the installer has.
The MSDN has a good example of how to create a custom action dll. It sounds like you might want to:
Installoverload, write the path into the stateSaver dictionaryUninstalloverload, read the path from the stateSaver dictionary(I’m assuming here you want to get rid of these files on uninstall)