How can I cause my Installation Package to automatically UnInstall a previous version of the application without having the user manually UnInstall the application? An installation MSI file can automatically uninstall a previous version of your application as part of the install process.
This is one of those things where Microsoft appears to have hidden the obvious solution to a problem. You would think that you would right-click on the Setup Project and choose View, Custom Actions and set some property under the Uninstall Folder, but that is not the way you accomplish this simple task.
Instead, you select the Setup project in the Project Explorer by left-clicking on it. Then, press F4 to display the properties window as shown in Figure 1. Set the RemovePreviousVersions property to true, as shown in Figure 1. Also, you must make sure that you increment some property Major, Minor, or Revision, of the version number to make it work. That's all there is to it.
Figure 1 - Setting the RemovePreviousVersions Property.