I have an installer written in Wix which sometimes prompts the user to reboot after repair. How can this occur and how to remove this behavior?
3 Answers
Two techniques:
1) Identify the cause of the reboot and avoid it. ( Examples: stop service, kill process )
2) Suppress reboot using the REBOOT property. Note repair may not be effective until after the reboot.
1 is usually the best way to go.
-
-
Typically a locked file hence why stopping processes that might have file locks. Jul 16, 2015 at 1:43
-
Why the repair may not be effective until after the reboot? My installer only deploys some files and write registry keys. In that case is it safe to use the REBOOT property? Jul 16, 2015 at 2:35
-
1If the installer needed to repair a locked file and the old file was wrong and the new file is correct then the new file won't be available until after the reboot. I suggest reading up on the Win32 MoveFile function and the PendingFileRenameOperations pattern. Jul 16, 2015 at 2:43
-
1Realize that MSI is declarative. They abstract what needs to be done from how it gets done. The latter is very seldom documented as you don't need to know. Presumably the InstallFiles and MoveFiles standard actions use MoveFileEx with the MOVEFILE_DELAY_UNTIL_REBOOT argument. You can search StackOverflow for those two words to see how frequently it comes up. Jul 16, 2015 at 11:52
The most common reason for a reboot after repairs is a file was accessed by the installer that the application still had a lock on. This is usually identifiable in the repair logs (sometimes it takes a bit of looking to find the file the installer had trouble with). If you are unable to find the information you need in your logs, post them here and we will take a look at them with you.
-
You want to look for these types of messages: msdn.microsoft.com/en-us/library/aa369779(v=vs.85).aspx Jul 16, 2015 at 1:45
-
It's also quite common for people to have a ScheduleReboot in the setup to force a reboot after first install, but they forget to condition it and so it happens on every repair.– PhilDWJul 16, 2015 at 17:23
Add this property somewhere relevant in your WXS file, and make sure nothing is overriding the value to something else. This will cause the reboot prompt to not occur and not have the reboot occur even if it was detected as necessary when running silently, as silent reboot prompts will automatically trigger the reboot sequence when you don't set this property's value to "ReallySuppress"
.
<Property Id="REBOOT" Value="ReallySuppress" />
You can read up on it here if you like: https://msdn.microsoft.com/en-us/library/windows/desktop/aa371101
-
1>> Add this property somewhere relevant in your WXS file << I found that I needed to define this property as a child element of Product, after the Package element had been defined. Apr 6, 2018 at 8:34