在本地-only模式C#启动项目开始调试 [英] Start debugging on C# startup project in native-only mode

查看:661
本文介绍了在本地-only模式C#启动项目开始调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MSVC2013解决方案,用C#(管理)和C ++(本机)项目。一个 C#项目设置为启动项目。我要开始这个项目的调试,这通常是在devenv的,只需按下F5键来实现的。

I have a MSVC2013 solution with C# (managed) and C++ (native) projects. One C# project is set as startup project. I want to start this project with debugging, which is usually achieved in devenv by simply pressing F5.

不过,我想在仅本机开始调试模式(即没有托管调试)。我不能改变C#项目的设置实现这一行为:它仅仅有一个选项启用原生代码调试,允许启用或禁用本机调试。我所知道的唯一的标准方式是无需调试启动应用程序,然后用连接只选择本机调试处理。

However, I want to start debugger in native-only mode (i.e. no managed debugging). I cannot achieve this behavior by changing settings of C# project: it only has an option "Enable native code debugging", which allows to enable or disable native debugging. The only standard way I know is to start application without debugging, and then attach to process with only native debugging chosen.

有没有办法自动执行此过程?理想情况下,按下一个按钮应该足以启动本机仅调试。或许有些扩展可以简化这一任务。

Is there a way to automate this process? Ideally, pressing one button should be enough to start native-only debugging. Perhaps some extension could simplify this task.

PS 的我已经碰到了一个讨厌的臭虫混合模式调试,这打破了我的情况完全调试。这个bug本身的不可以问题的话题,它只是解释了为什么本机只用C#启动项目的调试可能是有用的(并且是很有用的,就我个人)。

P.S. I have bumped into a nasty bug in mixed mode debugging, which breaks debugging completely in my case. This bug itself is not the topic of the question, it just explains why native-only debugging with C# startup project may be useful (and is useful to me personally).

推荐答案

为什么你不能简单地使用项目>属性>调试选项卡>勾选启用本地代码调试这不是很清楚。如果你使用VS2012和高达然后,一定要提防你必须禁用新的托管调试引擎,它不再是用C ++ / CLI代码兼容。使用工具>选项>调试>常规>勾选使用管理兼容模式。

It is not very clear why you can't simply use Project > Properties > Debug tab > tick "Enable native code debugging". If you use VS2012 and up then do beware that you have to disable the new managed debugging engine, it is no longer compatible with C++/CLI code. Use Tools > Options > Debugging > General > tick "Use Managed Compatibility Mode".

但你可以达到你想要的,只要选择本地代码项目之一,你的启动项目。右键单击>设置为启动项目。你必须选择启动EXE,单击鼠标右键>属性>调试>命令,将其更改为C#可执行文件。断点变得活跃一旦C#代码加载您的DLL(彩色固体红色)。

But you can achieve what you want, simply select one of the native code projects as your startup project. Right-click > Set as Startup Project. And you must select the startup EXE, Right-click > Properties > Debugging > Command, change it to the C# executable. Breakpoints become active (colored solid red) as soon as the C# code loads your DLL.

这篇关于在本地-only模式C#启动项目开始调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆