1
votes

I want to write an msi installer that uninstalls the previous version when it is run. I have a setup project in VS 2013 with DetectNewerInstalledVersion=True and RemovePreviousVersions=True. Here is what I do:

  1. I change the version number (eg from 1.0.3 to 1.0.4).
  2. I make sure the ProductCode changes and the UpgradeCode does not.
  3. I right click the setup project and click Build.
  4. I run the msi file in the Debug folder.

The msi runs just fine, but the old EXE is still in the programs folder. It successfully installs the program if it's a fresh installation though. What am I doing wrong?

2
Typically, you should only create an installer for the release version and the debug version should be used only for local use.Phil1970

2 Answers

6
votes

I've finally found the answer actually, and I'll post it here for people who stumble across this. Here's the one step I was missing:

You need to go to Properties > AssemblyInfo.cs in your project and update the AssemblyVersion and AssemblyFileVersion numbers. Otherwise your EXE for this project won't actually update. Hope this helps!

0
votes

Why don't you plant a custom action to backup and delete previous installation folder for additional safety :)