We currently have 4 installers for our client software:
- ClientSetupTest
- ClientSetupProduction
- ClientUpdateTest
- ClientUpdateProduction
The only differences between them are that the installer contains Crystal Reports redistributable files, but Update does not. Test and Production simply determines which environment they work in, and the only difference is in one line of the Client.exe.config file.
I don’t know, I know, so I replaced them with one installer after getting rid of Crystal Reports. The new installer writes the selected environment to the setup.config file referenced by the file attribute ( see here ).
The file attribute is new to the configuration file using this new installer. The problem I am facing is that if we change the Client.exe.config file on the old installation and then run the new installer, the configuration file will never be updated with the file attribute.
Is there a way to get it to update the file? RemovePreviousVersions does not work because it is a different installer if I do not understand something. My current idea, which is likely to work, is to add code in the OnBeforeInstall method to rename the old Client.exe.config file to the backup file, so it will always write a new one. It seems like there should be a simpler solution inside the installer itself. Any ideas?
EDIT: Client.exe.config.old base.OnBeforeInstall() . , .