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.
<PropertyRef Id="VS2010DEVENV" />
<Component Id="VisualStudioPackage2010" Guid="C8D37529-F79E-46B4-89FD-EA7BC6654770" Win64="no">
<File Source="votive2010.dll" KeyPath="yes" Checksum="yes" Vital="yes" />
<util:RestartResource Path="[VS2010DEVENV]" />
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.