0

I have a standard windows forms application that is being deployed using the VS2017 setup project. When opening the setup project using the "File System", I added to the application folder the following:

  1. Primary output from the win forms app.
  2. The EPPlus library's dll.
  3. Some excel files.

The setup project gives the output .msi package just fine. The problem is, when I run the .msi output after building the setup project (of course after building the source project) and run the application, I do not see my updates, even the files on C:\Program Files .... directory are not modified. I tried changing the product code and the increasing the version and it does not work. My questions are:

  1. Besides removing and installing the program again, is there anyway to make the installer package actually updating the software's installation?
  2. How to avoid the problem in #1 no matter how much I update the software?
  3. What is the cause and how to avoid this error "Another version of this product is already installed"? I'm not sure of what I did for it to pop up.
  4. If I want some part of the source code to be in a separate dll, is it as simple as adding a class library project and adding its output to the setup project?

Thank you very much.

PhilDW
  • 20,260
  • 1
  • 18
  • 28
3bdalla
  • 407
  • 1
  • 10
  • 28

1 Answers1

5

The way you do the upgrade is to use the RemovePreviousVersions project setting. The steps are:

  1. Increment the setup project's version and accept the changes, this will include a change of ProductCode.
  2. Make sure that RemovePreviousVersions is set true.
  3. The UpgradeCode (setup project properties) needs to be the same so don't change it.
  4. Increment the file versions of the binaries that need updating (that's the standard rule about updating versioned binaries).

The resulting MSI will do a major upgrade (in Windows Installer terminology) and upgrade the older version, replacing it with your new product MSI. Note that an upgrade will work only with the same context of install. An Everyone will not upgrade a Just me, so that will result in two entries in Programs and Features. Doing the install creating a verbose log and searching foe FindRelatedProducts entries will tell you if it found the upgrade or not. msiexec /I [path to msi file] /l*vx [path to a text log file]

There's a longer explanation here: https://www.red-gate.com/simple-talk/dotnet/visual-studio/updates-to-setup-projects/?_ga=2.138201520.1662048302.1514485579-1682631157.1514485579

which is old but relevant. and doesn't mention the requirement to update binary file versions (it wasn't needed with early VS setup projects).

PhilDW
  • 20,260
  • 1
  • 18
  • 28
  • Thank you very much. I have a question, the software is for internal use only, not a product for customers so a lot of changes needs to be done and deployed to my colleagues, is it necessary to increment the version number? Wouldn't changing the product code be sufficient? – 3bdalla Dec 28 '17 at 21:19
  • It did not work. It actually add another item in the Add/Remove Programs menu. – 3bdalla Jan 02 '18 at 07:24
  • See my edit about cross context upgrades - they re not supported. – PhilDW Jan 02 '18 at 19:58
  • It seems I was not upgrading the assembly version (Which should be what you meant in #4), now upgrading works as expected. Thanks! – 3bdalla Feb 20 '19 at 07:18