3

I am using a regular Visual Studio Setup Project to deploy my ASP.NET application. I need to handle the case of an existing web.config existing in the target directory. When one is found, it needs to be renamed before the install takes place. If this does not happen, the new web.config will not overwrite the old.

How can I get my custom action to rename the old web.config BEFORE the files being installed are copied?

So far I have tried by deriving from System.Configuration.Install.Installer and overriding the OnBeforeInstall, Install and Commit. It seems that all of these methods take place after the new files are copied into the target directory.

Bob
  • 97,670
  • 29
  • 122
  • 130
  • I am having the same problem, need to copy the existing config files to a new folder(folder name: appname + version no) before installation(MSI setup and deployment vs2010). Is it possible? – Praveen Mar 25 '13 at 12:22

1 Answers1

2

Do it in the Committing event. You said you tried to override 'Commit' but there is two commit events; Committing and Committed. The first occurs before the installers property commits its install, and the latter occurs after.

BBetances
  • 925
  • 1
  • 14
  • 23
  • Wow, Can't believe I missed that, it worked like a charm, thanks! – Bob Jan 14 '09 at 19:58
  • always found the new config in my case. i did not find the old one. Is there anything else i need to follow. @BBetances – Rezoan Oct 12 '13 at 10:52