In the Product.wxs, I set Schedule="afterInstallInitialize" in the MajorUpgrade so that if the installation fails, it will roll back to the previous version.
Our Windows Service uses app.config that the installer copied to the installed machine. We do this by including the below line in the Product.wxs:
<Component Id="Config" Win64="yes">
<File Source="$(var.WixWindowsService2012.TargetDir)WixWindowsService2012.exe.config"
Name="WixWindowsService2012.exe.config"
Vital="yes" KeyPath="yes" />
</Component>
We only want to copy this app.config file on the first installation, and we do NOT want to copy it in the subsequent installations.
When I comment out the above Component element in the Product.wxs, the installation failed because during installation, it deletes the app.config on the installed folder, and since the Windows Service requires it to run, the installation fails.
How can I make the installation to not copy the app.config to the installed folder if app.config already exists there ?
Thank you.