{"id":493,"date":"2010-09-16T23:25:19","date_gmt":"2010-09-16T23:25:19","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/heaths\/2010\/09\/16\/restart-manager-functionality-in-wix-3-5\/"},"modified":"2024-07-03T12:10:35","modified_gmt":"2024-07-03T20:10:35","slug":"restart-manager-functionality-in-wix-3-5","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/setup\/restart-manager-functionality-in-wix-3-5\/","title":{"rendered":"Restart Manager functionality in WiX 3.5"},"content":{"rendered":"<p>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\u2019t 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.<\/p>\n<p>To provide a better experience \u2013 and because this seems to be a fairly common request \u2013 I\u2019ve added a custom action in WiX 3.5\u2019s WixUtilExtension to use the <a href=\"http:\/\/msdn.microsoft.com\/library\/cc948910.aspx\">Restart Manager<\/a> in Vista and newer. The Restart Manager is capable of shutting down applications \u2013 similar to the normal files-in-use functionality in <a href=\"http:\/\/msdn.microsoft.com\/library\/cc185688.aspx\">Windows Installer<\/a> \u2013 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.<\/p>\n<p>To use this functionality yourself \u2013 even if you target Windows XP, for example \u2013 you can author the <code>RestartResource<\/code> element similar to the example below.<\/p>\n<pre style=\"font-family:\"><font face=\"Consolas\"><span style=\"color:\"><font color=\"#0000ff\"><font style=\"font-size: 12pt\">&lt;<\/font><\/font><\/span><font style=\"font-size: 12pt\"><span style=\"color:\"><font color=\"#a31515\">PropertyRef<\/font><\/span><span style=\"color:\"><font color=\"#0000ff\">&#160;<\/font><\/span><span style=\"color:\"><font color=\"#ff0000\">Id<\/font><\/span><span style=\"color:\"><font color=\"#0000ff\">=<\/font><\/span>&quot;<span style=\"color:\"><font color=\"#0000ff\">VS2010DEVENV<\/font><\/span>&quot;<\/font><\/font><font style=\"font-size: 12pt\"><font face=\"Consolas\"><font color=\"#0000ff\"><span style=\"color:\"> \/&gt;<\/span><br \/><span style=\"color:\">&lt;<\/span><\/font><span style=\"color:\"><font color=\"#a31515\">DirectoryRef<\/font><\/span><span style=\"color:\"><font color=\"#0000ff\">&#160;<\/font><\/span><span style=\"color:\"><font color=\"#ff0000\">Id<\/font><\/span><span style=\"color:\"><font color=\"#0000ff\">=<\/font><\/span>&quot;<span style=\"color:\"><font color=\"#0000ff\">BinDir<\/font><\/span>&quot;<\/font><font face=\"Consolas\"><font color=\"#0000ff\"><span style=\"color:\">&gt;<\/span><br \/><span style=\"color:\">&#160;&#160;&#160; &lt;<\/span><\/font><span style=\"color:\"><font color=\"#a31515\">Component<\/font><\/span><span style=\"color:\"><font color=\"#0000ff\">&#160;<\/font><\/span><span style=\"color:\"><font color=\"#ff0000\">Id<\/font><\/span><span style=\"color:\"><font color=\"#0000ff\">=<\/font><\/span>&quot;<span style=\"color:\"><font color=\"#0000ff\">VisualStudioPackage2010<\/font><\/span>&quot;<span style=\"color:\"><font color=\"#0000ff\">&#160;<\/font><\/span><span style=\"color:\"><font color=\"#ff0000\">Guid<\/font><\/span><span style=\"color:\"><font color=\"#0000ff\">=<\/font><\/span>&quot;<span style=\"color:\"><font color=\"#0000ff\">C8D37529-F79E-46B4-89FD-EA7BC6654770<\/font><\/span>&quot;<span style=\"color:\"><font color=\"#0000ff\">&#160;<\/font><\/span><span style=\"color:\"><font color=\"#ff0000\">Win64<\/font><\/span><span style=\"color:\"><font color=\"#0000ff\">=<\/font><\/span>&quot;<span style=\"color:\"><font color=\"#0000ff\">no<\/font><\/span>&quot;<\/font><font face=\"Consolas\"><font color=\"#0000ff\"><span style=\"color:\">&gt;<\/span><br \/><span style=\"color:\">&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;<\/span><\/font><span style=\"color:\"><font color=\"#a31515\">File<\/font><\/span><span style=\"color:\"><font color=\"#0000ff\">&#160;<\/font><\/span><span style=\"color:\"><font color=\"#ff0000\">Source<\/font><\/span><span style=\"color:\"><font color=\"#0000ff\">=<\/font><\/span>&quot;<span style=\"color:\"><font color=\"#0000ff\">votive2010.dll<\/font><\/span>&quot;<span style=\"color:\"><font color=\"#0000ff\">&#160;<\/font><\/span><span style=\"color:\"><font color=\"#ff0000\">KeyPath<\/font><\/span><span style=\"color:\"><font color=\"#0000ff\">=<\/font><\/span>&quot;<span style=\"color:\"><font color=\"#0000ff\">yes<\/font><\/span>&quot;<span style=\"color:\"><font color=\"#0000ff\">&#160;<\/font><\/span><span style=\"color:\"><font color=\"#ff0000\">Checksum<\/font><\/span><span style=\"color:\"><font color=\"#0000ff\">=<\/font><\/span>&quot;<span style=\"color:\"><font color=\"#0000ff\">yes<\/font><\/span>&quot;<span style=\"color:\"><font color=\"#0000ff\">&#160;<\/font><\/span><span style=\"color:\"><font color=\"#ff0000\">Vital<\/font><\/span><span style=\"color:\"><font color=\"#0000ff\">=<\/font><\/span>&quot;<span style=\"color:\"><font color=\"#0000ff\">yes<\/font><\/span>&quot;<\/font><font face=\"Consolas\"><font color=\"#0000ff\"><span style=\"color:\"> \/&gt;<\/span><br \/><span style=\"color:\">&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;<\/span><\/font><span style=\"color:\"><font color=\"#a31515\">util:RestartResource<\/font><\/span><span style=\"color:\"><font color=\"#0000ff\">&#160;<\/font><\/span><span style=\"color:\"><font color=\"#ff0000\">Path<\/font><\/span><span style=\"color:\"><font color=\"#0000ff\">=<\/font><\/span>&quot;<span style=\"color:\"><font color=\"#0000ff\">[VS2010DEVENV]<\/font><\/span>&quot;<\/font><font face=\"Consolas\"><font color=\"#0000ff\"><span style=\"color:\"> \/&gt;<\/span><br \/><span style=\"color:\">&#160;&#160;&#160; &lt;\/<\/span><\/font><span style=\"color:\"><font color=\"#a31515\">Component<\/font><\/span><\/font><\/font><font face=\"Consolas\"><font style=\"font-size: 12pt\"><font color=\"#0000ff\"><span style=\"color:\">&gt;<\/span><br \/><span style=\"color:\">&lt;\/<\/span><\/font><span style=\"color:\"><font color=\"#a31515\">DirectoryRef<\/font><\/span><\/font><span style=\"color:\"><font style=\"font-size: 12pt\" color=\"#0000ff\">&gt;<\/font><\/span><\/font><\/pre>\n<p>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.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/heaths\/wp-content\/uploads\/sites\/13\/2010\/09\/6545.image_thumb_3EB5E8D9.png\"><img decoding=\"async\" style=\"border-bottom: 0px;border-left: 0px;margin:;padding-left: 0px;padding-right: 0px;border-top: 0px;border-right: 0px;padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/heaths\/wp-content\/uploads\/sites\/13\/2010\/09\/6545.image_thumb_3EB5E8D9.png\" width=\"513\" height=\"402\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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\u2019t 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 [&hellip;]<\/p>\n","protected":false},"author":389,"featured_media":3843,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[10,20,44,45,63,64],"class_list":["post-493","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-custom-actions","tag-installation","tag-vista","tag-visual-studio","tag-windows-7","tag-wix"],"acf":[],"blog_post_summary":"<p>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\u2019t 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 [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/posts\/493","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/users\/389"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/comments?post=493"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/posts\/493\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/media\/3843"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/media?parent=493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/categories?post=493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/tags?post=493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}