2012-01-30 28 views
1

问题是我想重新启动我的应用程序以升级当前应用程序。为此,我使用下面提到的两行代码。在WPF中重新启动应用程序

System.Windows.Forms.Application.Restart(); 

Process.GetCurrentProcess().Kill(); 

OR

System.Windows.Forms.Application.Restart(); 

Application.Current.Shutdown(); 

但是,这给人一种 “An unhandled win32 exception is occurred” 的错误消息。因此这不起作用。

任何帮助将不胜感激。

+0

可能重复http://stackoverflow.com/questions/4773632/how-do-i-restart-a- wpf-application) – 2012-01-30 06:20:09

+0

发布异常的堆栈跟踪可能是一个开始。什么是抛出该Win32异常? – 2012-01-30 06:21:19

+0

嗨科迪格雷,我已经尝试与[链接](http://stackoverflow.com/questions/4773632/how-do-i-restart-a-wpf-application)这个链接。但是现在它给出的错误是“应用程序对象正在关闭”。 – Prasanta 2012-01-30 06:32:29

回答

0

你试过了吗?

Application.Restart(); 

System.Diagnostics.Process.Start(Application.ExecutablePath); 
Application.Exit(); 
的[如何重新启动WPF应用程序?(