VS2010 Web Setup Project not replacing 'web.config' file

870 views Asked by At

I am using VS2010 web setup project for my MVC3 webapplication. It is working fine with installation. But if I update the version of MVC3 webapplication binary and Web setup project for upgrade (from existing installation of older version) it will not replacing the web.config file on destination directory. All other files and directories are replaced and updated but only 'web.config' file is not replaced by the Web setup.

I am changing the version of Web setup project and MVC3 application each time when I update anything in web application.

I also tried with changing the "ProductCode" and "UpgradeCode" but still web.config file is same (of first version)

I set following property of Web setup project

  • DetectNewerInstalledVersion - True
  • Removepreviousversions - True
  • RestartWWWService - true

If I remove/delete the existing web.config file manually and then install the new version than it will put the new updated web.config file. The problem is only occurs when there is existing web.config file is available in destination directory.

I also tried custom action's "OnBeforeInstall" to delete or rename the existing web.config file so that new we.config will copy in installation. But in that I found that all files are copied before the custom action method execute.

Please help me to resolve this or suggest an alternative way to provide web setup project to my clients.

Thanks in advance!

Edit: I found that when I change the version of Web Setup project, It will automatically change the productcode but upgradecode is still same.

1

There are 1 answers

1
vinay On

When installation, installer will check the version of each file that it will replace. So if a file is of same version or it is not changed between two installers, installer will not replace it. But if that file does not exist, installer will drop that file.

Solution: Try deleting file before "costfinilize". So in your case call custom action to delete\remove file before "costfinilize".

You can use Orca to check execution sequence of all custom action of an msi. http://msdn.microsoft.com/en-us/library/windows/desktop/aa370557(v=vs.85).aspx