卸载时关闭应用程序-wix
我正在使用WIX3.6。我有一个问题,在卸载时,如果任务栏中显示任何打开的窗口(此窗口是我的msi的一部分,我正在尝试卸载),它会显示一个对话框,要求用户关闭应用程序(“在继续安装之前应关闭以下应用程序”) 我尝试了以下方法,但没有成功卸载时关闭应用程序-wix,wix,close-application,Wix,Close Application,我正在使用WIX3.6。我有一个问题,在卸载时,如果任务栏中显示任何打开的窗口(此窗口是我的msi的一部分,我正在尝试卸载),它会显示一个对话框,要求用户关闭应用程序(“在继续安装之前应关闭以下应用程序”) 我尝试了以下方法,但没有成功 <InstallExecuteSequence> <Custom Action="WixCloseApplications" Before="InstallInitialize">Instal
<InstallExecuteSequence>
<Custom Action="WixCloseApplications"
Before="InstallInitialize">Installed</Custom>
<Custom Action="StartMonitor"
After="StartServices">NOT Installed</Custom>
</InstallExecuteSequence>
<util:CloseApplication Id="CloseMonitor" Target="Monitor.exe"
CloseMessage="yes" RebootPrompt="no">
Installed
</util:CloseApplication>
安装
未安装
安装
我希望wix检测应用程序并在卸载过程中关闭它们。无需显示对话框提示。谁能帮我实现它
使用/qn开关从命令提示符安装,但没有/qn开关时,会出现对话框(“在继续安装之前,应关闭以下应用程序”)。
有人能帮我解决这个问题吗。添加一个C#
自定义事件,并在InstallUISequence
上添加make it first event,并使用以下代码终止进程:try
{
Process proc = Process.GetProcessesByName("MyApplication");
proc.Kill();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
如果您的应用程序支持多个实例,则首先计算实例数:
如果您根本不使用And
DllEntry
,那么请遵循此操作您好,谢谢您的建议,我被要求不要使用C#,因此没有尝试您的建议。请参见wix的内置操作或功能非常少,因此您必须使用外部代码。它可能是c#或任何其他语言。我将InstallInitialize更改为InstallValidate,工作正常Installed@sanam_bl在这种情况下,回答你自己的问题并接受它。因此,将来如果您或其他人提及此问题,可能会知道解决方案,我将InstallInitialize更改为InstallValidate,安装后效果良好
int count = 0;
Process[] process = Process.GetProcessesByName("MyApplication");
foreach (Process pr in process)
{
if (pr.MainModule.FileName.Equals(Assembly.GetExecutingAssembly().Location, StringComparison.OrdinalIgnoreCase))
{
count++;
}
}