In-use files not updated by MSI-installer (Visual Studio Installer project)

后端 未结 5 691
清歌不尽
清歌不尽 2020-11-28 16:41

I\'m using the Visual Studio Installer Projects extension to build the MSI-installer for my application. However, my application is meant to be running at all times, and if

相关标签:
5条回答
  • 2020-11-28 17:21

    It would be useful to know more about your application and how you are doing the upgrade because:

    1. You will normally see a FilesInUse dialog saying that files are in use, prompting the user to shut them down, but not if the install is silent.

    2. Visual Studio setups have no built-in support for shutting down and restarting services, so if your app is a service you'll need extra work.

    3. Files that actually do need to be replaced will prompt the user for a reboot (if they are not previously shut down) in order to replace them at reboot time.

    So if you're not seeing reboot requests or FilesInUse dialogs in a UI install then something else is going on. So you need to be sure that:

    a. You are really doing an upgrade where the version of the setup project has been incremented, the UpgradeCode is the same (and the ProductCode changes when you increment the setup project's version). Your symptoms could be the result of the upgrade not working and you're seeing just a repair.

    b. The definition of "new version" is that you have an upgrade as in a., AND, the file versions of the binaries have been incremented. The default overwrite rules for installs require incremented file versions, so if they haven't been incremented you'll see no updates, and Windows will not attempt to show FilesInUse dialogs or reboot because there are no files that need replacing.

    0 讨论(0)
  • 2020-11-28 17:22

    We had this problem, and the solution we came up with was to create two apps; the user app and an updater app. The MSI installs both. Each app checks if the other needs updating and, if it does, closes the other app, downloads the other app's updater, runs it, then relaunches the other app. Additionally, each app monitors if the other app is running and, if it isn't, launches it.

    0 讨论(0)
  • 2020-11-28 17:25

    According to below link

    https://social.msdn.microsoft.com/Forums/windows/en-US/0b40b367-3341-43d8-b82e-1ace546969f8/how-can-installation-stop-and-restart-existing-service-?forum=winformssetup

    "There is no good support in VS installs to stop and start services. During install, the issue is that custom actions run after everything is installed so it's too late to stop a service that you are upgrading or replacing. Yes, they have names like "BeforeInstall" but they really are not before the install."

    0 讨论(0)
  • 2020-11-28 17:33

    This isn't a solution to the problem, but rather another solution; the one requiring the least work in the end.

    I ended up not using 'Visual Studio Installer Projects' for my installer. Instead I looked to Advanced Installer, which just works with no issues. Things like this is taken into account, and custom actions allow for more options.

    If your project is open source, you can write to them about a free open source "professional" license, equal to their "professional" plan, which is normally $399 (onetime purchase).

    0 讨论(0)
  • 2020-11-28 17:37

    REBOOT: How are you installing this MSI? What command line? If you set REBOOT=ReallySuppress on the command line, you will not be prompted for a reboot even if one is required to complete the installation of the product.

    msiexec.exe /i MySetup.msi /QN REBOOT=ReallySuppress
    

    If you are using a distribution system I suppose suppressing reboot prompts could be standard behavior. Then your product files should be put in place after a reboot (PendingFileRenameOperations or perhaps some newer mechanism).

    It is also possible that Visual Studio Installer Projects do something strange that I am not aware of.


    Log: I would try to create a good log file for the install, to determine what is going on:

    msiexec.exe /i C:\Path\Your.msi /L*v C:\Your.log
    

    Log All MSIs: Personally I like to enable logging for all MSI installations - as described in the "Globally for all setups on a machine" section in the above link.

    Interpreting an MSI log: interpreting a log file can be challenging sometimes. Here is an answer with some links to help with this.


    Reboot Manager: Reboot management is a very complex topic, and Windows features functionality - in the form of the restart manager feature - to try to minimize the need for reboots, by instead shutting down and restarting applications as part of an installation in an "auto-magical" fashion (application listens for messages and shuts itself down gracefully when told to, and the system may restart the application after the install - if configured to do so).

    Updating your application to comply with the restart manager is the only real fix for such problems that you see, in my opinon.

    • The section "Restart Manager" in this question tries to summarize how to implement such support (maybe just read the yellow section a bit down the page).
    • The Advanced Installer guys have a very nice, technical article about this: How do I add support for Windows Restart Manager to my application? Also linked to in the link directly above - still worth a direct link here I think.
    0 讨论(0)
提交回复
热议问题