在我的C#WPF应用程序中,我正在检查是否需要安装新版本。如果是这样,我想打破当前的过程,并开始安装。安装程序是使用NSIS包开发的。 问题是,有时只有来自NSIS安装程序的用户帐户控制对话框出现并安装进程中断。从c#wpf应用程序运行安装过程
如何确保安装过程中,每次执行?
这是我在应用程序启动时的代码。
protected override void OnStartup(StartupEventArgs e)
{
try
{
//Disable shutdown when the dialog closes
Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;
if (IfUpdateRequired())
{
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(sessionCtx.AutoUpdateVersionInfo.SetupPath);
//This should not block current program
startInfo.UseShellExecute = true;
startInfo.Verb = "runas";
System.Diagnostics.Process.Start(startInfo);
this.Shutdown();
}
else
{
base.OnStartup(e);
}
}
catch (Exception ex)
{
}
}
你可能会添加一个“启动屏幕通知系统修改”的屏幕截图,因为我不太明白你在说什么。 – Anders
我的意思是“用户帐户控制对话框”。 – iljon
“安装过程中断”时会发生什么?有没有任何错误信息或类似的东西? – Anders