VS2017 Installer project output does not replace the current installation

冷暖自知 提交于 2020-01-06 08:52:30

问题


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.


回答1:


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).



来源:https://stackoverflow.com/questions/48008754/vs2017-installer-project-output-does-not-replace-the-current-installation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!