title: Force overwrite of App.config during installation
body: <p>We currently have 4 installers for our client software:</p>
  
  <ul>
  <li>ClientSetupTest </li>
  <li>ClientSetupProduction</li>
  <li>ClientUpdateTest</li>
  <li>ClientUpdateProduction</li>
  </ul>
  
  <p>The only differences between them are that Setup contains the Crystal Reports redistributable files, and Update doesn't. Test and Production just specifies which environment they run in and the only difference there is one line in the Client.exe.config file. </p>
  
  <p>Dumb, I know, which is why I replaced them all with one installer after getting rid of Crystal Reports. The new installer writes the selected environment out to setup.config, which is referenced by the file attribute (<a href="https://stackoverflow.com/questions/523619/how-can-i-set-application-settings-at-install-time-via-installer-class/539277#539277">see here</a>).</p>
  
  <p>The "file" attribute is new to the config file with this new installer. The problem I'm running into is that if we modify the Client.exe.config file on an old installation, then run the new installer, the config file never gets updated with the "file" attribute.</p>
  
  <p>Is there any way to force it to update a file? RemovePreviousVersions doesn't exactly work, since it's a different installer, unless I'm misunderstanding something. My current idea, which will probably work, is to add code in the OnBeforeInstall method to rename the old Client.exe.config to a backup file, so it'll always write the new one. Seems like there should be a simpler solution within the installer itself, though. Any ideas?</p>
  
  <p><strong>EDIT</strong>: Renaming the old config file to Client.exe.config.old before calling base.OnBeforeInstall() didn't work. It renamed the file, but never wrote the new one.</p>