5
votes

I am using Visual Studio 2010, I am working on a windows application and while trying to make an automatic updater for it faced a serious problem.

When the program find a new version and trying to install it, it couldn't because of two reasons:

1- the application is exist in my program files. so that window appears enter image description here

2- the application is already opened "the form that performed the update process".

The problem doesn't have any relation with the version number.

It's about the program existence and the ability to install a new version although the previous version is opened.

4
do you update your MSI file automatically? If so, there are some GUID which need to be updated, if not, the Setupinterpreter doesn't realize that this is a different version - nobs
when the application loads it search for a new version from xml file then it downloads the new msi and open it for installation . @nobs - Hassanation

4 Answers

6
votes

To enable the automated major upgrade mechanism you need to increase the ProductVersion and change the ProductCode. This is done through the project Properties pane.

You can read more about upgrades here: http://msdn.microsoft.com/en-us/library/windows/desktop/aa370579(v=vs.85).aspx

2
votes

Cosmin is correct, but if you want more specific steps, try following the steps outlined in this other Stack Overflow post:

0
votes

If you are looking to update an existing program this is known as patching so you don't need to use an MSI which is an installer, instead please look into MSP instead of MSI.

http://msdn.microsoft.com/en-us/library/windows/desktop/aa370578(v=vs.85).aspx

For us - we have used a loading screen and hooked up to a SQL table which posses a list of relevant .DLL's in binary. I then use reflection to check the version number compared to the one in the start up directory and if it is newer then replace it - That's just another idea but if you are looking at updating exisiting software with a package of some sort, take a look into MSP's.

0
votes

Steps to make msi overwrite program, if previous version exits..!

  1. In Visual studio 2019, -> (F4 btn)Properties window should be open.
  2. Just click on your "SetUp project" file.
  3. MSI package Properties will get open.
  4. Make "RemovePreviousVersions" as True.

Prerequisites

  1. UpgradeCode should be same for older version & new version.
  2. MSI version should be greater than old version.

-For reference attaching the example image.

enter image description here