Restart Manager functionality in WiX 3.5



WiX 3.5 provides features to integrate with Visual Studio 2005, 2008, and 2010. But like many add-ins, since new files are being added they certainly can’t be in use by devenv.exe. So when we call devenv.exe /setup as part of our install, the changes may not show up in running instances of Visual Studio.

To provide a better experience – and because this seems to be a fairly common request – I’ve added a custom action in WiX 3.5’s WixUtilExtension to use the Restart Manager in Vista and newer. The Restart Manager is capable of shutting down applications – similar to the normal files-in-use functionality in Windows Installer – but is also capable of restarting some of those applications. Visual Studio is not, unfortunately, one of those programs. But because Restart Manager provides APIs to add resources like file paths to devenv.exe, we can tell Windows Installer to detect and prompt that Visual Studio needs to be closed. Contrast this with detecting that Visual Studio is running and raising an error dialog. After you close Visual Studio, then you have to restart setup.

To use this functionality yourself – even if you target Windows XP, for example – you can author the RestartResource element similar to the example below.

Now when you install WiX 3.5 when Visual Studio is running, you should see the following message asking you to shut it down automatically or reboot after installation is complete. Because you are installing new files it will not actually prompt to reboot but you will not be able to use WiX successfully until you restart Visual Studio or start a new instance.


Heath Stewart

Senior Software Engineer

Follow Heath   

No Comments.