如果它不是启动项目,如何在c ++应用程序中点击断点

时间:2018-06-01 15:39:30

标签: c# c++ visual-studio debugging breakpoints

我有一个包含两个项目的VS2010解决方案:C#windows form& C ++控制台应用程序。 C#项目是启动项目,它将调用C ++应用程序,我还正确设置构建优先级和依赖关系,但c ++项目中的断点不会在调试模式下出现,这是我的C#代码:

static void Main()
{
    string CppPath = System.IO.Path.GetFullPath(System.IO.Path.Combine(Environment.CurrentDirectory.ToString(), @"..\..\..") + @"\Debug\");
    System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(CppPath + "CommunicationServerCpp.exe");
    startInfo.WorkingDirectory = CppPath;
    System.Diagnostics.Process.Start(startInfo);


    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);
    Application.Run(new Form1());
}

我不想将它们分成两个解决方案,所以我该如何解决?

1 个答案:

答案 0 :(得分:4)

在调试菜单中有"附加到进程"。

在控制台项目中,您需要创建一个暂停/延迟功能,等待您连接VS调试器。

无法在1个VS实例中调试2个项目 - 因此必须启动第二个实例。