I had problems with that it would work on install but not uninstall or vice versa, I gave up and used the custom action...
-----Original Message----- From: Rob Mensching [mailto:r...@robmensching.com] Sent: January-30-13 10:12 AM To: General discussion for Windows Installer XML toolset. Subject: Re: [WiX-users] Detect specific running application during installation with WIX. I'd argue your best bet is to use the RestartResource element in the Util extension to add the resource to the restart manager and let it do all the work for you. In the case of Office apps, it should be particularly better because Office apps register with restart manager and automatically save state, close, then reopen. -----Original Message----- From: Steven Ogilvie [mailto:steven.ogil...@titus.com] Sent: Tuesday, January 29, 2013 6:06 AM To: General discussion for Windows Installer XML toolset. Subject: Re: [WiX-users] Detect specific running application during installation with WIX. Your best bet is to create a custom action i.e. I close Outlook at the beginning of the install, then relaunch it after the install (if Outlook was indeed closed) /// <summary> /// Kills Outlook just as the install/uninstall starts /// </summary> /// <param name="session"></param> /// <returns>return ActionResult.Success</returns> [CustomAction] public static ActionResult CloseOutlookProcess(Session session) { try { if (session == null) { throw new ArgumentNullException("session"); } // set registry key that shut down Outlook succeeded const string userRoot = "HKEY_LOCAL_MACHINE"; const string key = "SOFTWARE\\MYCORP\\Setup"; const string closeOutlook = "CloseOutlook"; Registry.SetValue(userRoot + "\\" + key, closeOutlook, "0"); // Assuming there won't be any other process with the same name as outlook :) Process[] processes = Process.GetProcessesByName("OUTLOOK"); bool allOutlookProcessesExited = true; if (processes.Length > 0) { foreach (Process outlookProcess in processes) { try { outlookProcess.CloseMainWindow(); // set registry key that shut down Outlook succeeded Registry.SetValue(userRoot + "\\" + key, closeOutlook, "1"); // wait some time and check again to see if the process has exited System.Threading.Thread.Sleep(4000); allOutlookProcessesExited = outlookProcess.HasExited && allOutlookProcessesExited; } catch (Exception exception) { WriteErrorLogInstall(session, "CloseOutlookProcess; failed to close Outlook: ", exception, true); } finally { // dispose process if (outlookProcess != null) { outlookProcess.Dispose(); } } } } if (!allOutlookProcessesExited) { MessageBox.Show( "Please close any instances of Microsoft Outlook, to continue with this installation", "Custom action exception error...", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { WriteErrorLogInstall(session, "CloseOutlookProcess failed: ", ex, true); } return ActionResult.Success; } -----Original Message----- From: Yawar Khan [mailto:yawar.k...@live.com] Sent: January-29-13 8:56 AM To: wix-users@lists.sourceforge.net Subject: [WiX-users] Detect specific running application during installation with WIX. Hi, Can anyone please help me to detect any running process through WIX and ask user to close it?Following code is detecting the installed application is running during "repair". But it was not working to detect Internet Explorer during "installation". <InstallExecuteSequence> <Custom Action="WixCloseApplications" Before="InstallInitialize" /></InstallExecuteSequence> <util:CloseApplication Id="CloseSuperForm" CloseMessage="no" Description="close it" ElevatedCloseMessage="no" RebootPrompt="no" Target="myapp.exe" /> <util:CloseApplication Property="MsWordRunning" Id="CloseIE" CloseMessage="no" Description="Close Internet Explorer" ElevatedCloseMessage="no" RebootPrompt="no" Target="iexplore.exe" /> Please also provide the possible choices of "Before" and "Action" under "Custom" tag. ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_jan _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_jan _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users