Launch WPF application using Process.Start

后端 未结 1 1519
野的像风
野的像风 2021-01-21 22:18

I am attempting to launch a wpf application using Process.Start. When I launch the process by double-clicking it in explorer.exe, it l

相关标签:
1条回答
  • 2021-01-21 23:13

    I fixed the problem this way:

    Process proc = new Process();
    proc.StartInfo.FileName = programPath;
    proc.StartInfo.WorkingDirectory = Path.GetDirectoryName(programPath);
    proc.Start();
    

    The trick was to set the working directory to the path of the WPF application, rather than the working directory of the launching application.

    0 讨论(0)
提交回复
热议问题