问题
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:
- Primary output from the win forms app.
- The
EPPlus
library's dll. - 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:
- Besides removing and installing the program again, is there anyway to make the installer package actually updating the software's installation?
- How to avoid the problem in #1 no matter how much I update the software?
- 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.
- 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:
- Increment the setup project's version and accept the changes, this will include a change of ProductCode.
- Make sure that RemovePreviousVersions is set true.
- The UpgradeCode (setup project properties) needs to be the same so don't change it.
- 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