Can not debug a Project started using Process.Start()

前端 未结 5 1314
青春惊慌失措
青春惊慌失措 2021-01-02 02:49

I have two C# WinForm projects in the same solution lets call them A and B. Project A starts Process B via a call like below

ProcessStartInfo psi = new Proce         


        
5条回答
  •  渐次进展
    2021-01-02 02:56

    Try getting the process ID from Program B, something like:

    ProcessStartInfo psi = new ProcessStartInfo();
    psi.FileName = Task.EXEFilename;
    psi.WorkingDirectory = Path.GetDirectoryName(Data.EXEFilename);
    var proc = Process.Start(psi);
    
    Debug.WriteLine(proc.Id);
    

    Then load your project up in another instance of Visual Studio and use Debug > Attach to process to attach to Program B.

提交回复
热议问题