Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 重启WPF应用程序的正确方法是什么?_C#_.net_Wpf_Clickonce - Fatal编程技术网

C# 重启WPF应用程序的正确方法是什么?

C# 重启WPF应用程序的正确方法是什么?,c#,.net,wpf,clickonce,C#,.net,Wpf,Clickonce,我想以编程方式重新启动WPF应用程序;在我使用的windows窗体中 System.Windows.Forms.Application.Restart() 我试过这个: private void Restart() { System.Diagnostics.Process.Start(Application.ResourceAssembly.Location); Application.Current.Shutdown(); } 我已使用ClickOnce部署了我的应用程

我想以编程方式重新启动WPF应用程序;在我使用的windows窗体中 System.Windows.Forms.Application.Restart()

我试过这个:

private void Restart() 
{
    System.Diagnostics.Process.Start(Application.ResourceAssembly.Location); 
    Application.Current.Shutdown(); 
}
我已使用ClickOnce部署了我的应用程序,但它在那里不起作用。
任何帮助都会很好。

但是它在本地有效吗?@rene是的,它在本地有效。@Sayse它不是正确的副本。这个问题是通过ClickOnce部署的,而ClickOnce并没有在特定的副本中解决…@rene-在这种情况下,是另一个google搜索,特别是Ok,我们将确保我们关闭该副本@Sayse