wixwindows-installerrebootfile-in-userestartmanager

Windows Installer-Avoid FileinUse dialog box when Installing a package


When ever there is an update patch of files that have to be replaced with the existing files and if one of the files is being used by any of the processes, then a file in use dialog box pops-up.I wanna avoid that dialog box and get that file queued up for installation so that it can be installed at the time of system reboot. I have read that the queuing the files for update at the time of reboot is the inbuilt functionality of windows installer. Can someone suggest me the way to remove that FileInUse Dialog box. I tried setting up the "MsiRMFilesInUse" property to "0" but it didn't work.


Solution

  • "Short" Answer

    Essentially: you could 1) run completely silently (suppresses the files-in-use dialog), 2) shut down locking applications gracefully (application update to allow graceful shutdown - with or without restart manager support), 3) ensure proper service control (if dealing with services), 4) force-kill running processes (the "sledgehammer-approach"), 5) abort setup if locks are detected, 6) require logoff before deployment, 7) install to a new folder for each version (side-by-side install), etc...

    Below is a little drill-down of files-in-use issues and the Restart Manager - intended as a quick review for files-in-use and reboot issues.

    In terms of your actual problem. I wouldn't mess with the FileInUse dialog(s). It won't really solve your problem. Maybe consider these pointers:

    I suppose you could also abort the install if locked files are detected, or you could require users to log off before the installation is run - if you have a distribution system.

    Please at least skim the rest of the answer for more details and context.


    Restart Manager

    Your applications and services should be prepared to be shut down by the Restart Manager and save user data and state information that are needed for a clean restart. This requires updates and changes to the application / service to adhere to standards for shutdown and restart of the application.


    The Restart Manager: is a new C-style API available beginning with Windows Vista and Windows Server 2008. Restart Manager consists of a single DLL that applications can load to access the Restart Manager API. The idea is that the Restart Manager will auto-magically shut down and restart your applications during installations / updates, by having the application / service follow a set of guidelines:

    In essence: The whole idea is basically to prefer restarting applications rather than restarting the OS - and also to avoid reboots in general.. To that end: 1) Your application calls RegisterApplicationRestart() with a command line specified for its eventual restart - it "signs up" for restart management. 2) Your application watches for WM_QUERYENDSESSION messages and shuts down gracefully saving data in an appropriate way when told to do so. 3) Then Restart Manager can restart the application when finished installing (restart can be disabled).

    More Technical stuff:


    Restart Manager Configuration: There are a number of properties that will affect how the Restart Manager will operate with Windows Installer:

    When Restart Manager is used, the MsiRMFilesInUse dialog is used instead of the FileInUse dialog to show a list of applications that have locked files.

    N.B! The whole Restart Manager feature can also be disabled by policy:


    FileInUse

    If you don't have the time or resources to implement proper interoperability with the Restart Manager (which is frankly the only sane thing to spend your resources on at this point in Windows's development), then there are a few things that might be good to know:


    Some Further Links: