how to code an MSI to ensure installation roll-back when a file is in use (Windows Installer question)

Alan Sinclair 11 Reputation points
2021-01-29T22:13:13.863+00:00

If I'm installing an MSI using silent operation (e.g msiexec /q /norestart /i my.msi /l my.log) what code in the MSI will ensure that the install (or upgrade when it's an upgrade) rolls back if the "Files in use" situation occurs?

When the install is NOT silent, windows installer pops up the "Files in use" dialog, with options either:

  1. to close the file in use
  2. do not close the file in use, reboot required after install
  3. cancel the install

Our process requires option 3 - the install must abort/cancel if there's a file in use. Delayed reboot must be disallowed.


[I need information on the appropriate Windows Installer function and arguments please. For reference our MSI is coded with the Wix Toolset, but that's irrelevant to this question]

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,589 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.