Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/22.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.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# 将当前运行的进程附加到现有调试器实例_C#_.net_Debugging_Visual Studio 2013 - Fatal编程技术网

C# 将当前运行的进程附加到现有调试器实例

C# 将当前运行的进程附加到现有调试器实例,c#,.net,debugging,visual-studio-2013,C#,.net,Debugging,Visual Studio 2013,我的用例是,当一段代码作为.exe.,比如A项目运行时,我需要执行另一个C#可执行文件,比如B项目,该项目正在同时开发中。B项目执行是通过过程.NET类型处理的 这就是B项目的执行方式 public override string Run(string executablePath) { Process environmentProcess = new Process(); string inputPath = GetInputPath(); string inputF

我的用例是,当一段代码作为
.exe.
,比如
A
项目运行时,我需要执行另一个C#可执行文件,比如
B
项目,该项目正在同时开发中。
B
项目执行是通过
过程
.NET类型处理的

这就是
B
项目的执行方式

public override string Run(string executablePath)
{
    Process environmentProcess = new Process();

    string inputPath = GetInputPath();
    string inputFormat = GetInputFormat();
    string outputPath = GetOutputPath();

    GenerateOptions(inputPath, inputFormat);

    string args = string.Format("-i \"{0}\" -f {1} -o \"{2}\"", inputPath, inputFormat, outputPath);

    ProcessStartInfo startInfo = new ProcessStartInfo
    {
        FileName = executablePath,
        Arguments = args
    };

    environmentProcess.StartInfo = startInfo;
    environmentProcess.Start();
    environmentProcess.WaitForExit();

    return GetOutput(outputPath);
}
要运行该解决方案,我只需点击F5,它运行
A
,并附加调试器,然后
A
进程依次执行
B

我想要实现的是自动化将调试器附加到
B
进程的过程。我知道
System.Diagnostics.Debugger.Launch(),但这会创建一个全新的VS实例来附加调试器。我希望它几乎完全是这样,除了我希望能够将
B
附加到Visual Studio及其调试器的现有实例上


有可能吗

你尝试过多个创业项目吗?右键单击解决方案窗口->选择属性->选择启动项目->检查多个启动项目,并将每个项目类型的操作更改为启动。我应该给出如何执行
B
项目的明确代码段。看到我即将发布的更新看起来像你正在寻找的…感谢你的资源。回顾内容告诉我,实际上它是关于同时调试多个进程的,但是这包括了如何通过VS显式运行一个或多个进程。我的情况不同-另一个
B
可执行文件意味着在某个时候由
A
项目运行。我看不到这个案例的任何细节:(WinDbg允许您调试子进程。