VS2022:是否有一种更快的方法来切换“启用本机代码调试”。环境?

发布于 2025-01-21 13:35:38 字数 496 浏览 0 评论 0原文

我使用托管(C#)和本机(C ++)代码的解决方案。托管代码调用C ++。通常,我的本机代码调试禁用是因为它使整个体验较慢,但是我有很多次需要启用它。

不幸的是,该过程很麻烦:

  1. 右键单击项目。
  2. 选择“属性”。
  3. 选择“调试”类别。
  4. 单击“打开启动配置文件UI”。
  5. 向下滚动。
  6. 单击“本机代码调试”复选框。

我想让这个更快。我希望可能有一些命令可以将钥匙绑定到。 I tried going into Tools >> Customize and searching for a command that had "Native" or "Managed" in it. I didn't find anything that was like what I want.

Does anyone know a faster way to toggle this setting?

I work on a solution with both managed (C#) and native (C++) code. The managed code calls into the C++. I typically have native code debugging disabled because it makes the whole experience slower but I have many times where I need to enable it.

Unfortunately the process is cumbersome:

  1. Right click on project.
  2. Choose "Properties".
  3. Choose "Debug" category.
  4. Click "Open Launch Profiles UI".
  5. Scroll down.
  6. Click the "Native Code Debugging" checkbox.

I wanted to make this faster. I was hoping there might be some command for it that I could bind a key to. I tried going into Tools >> Customize and searching for a command that had "Native" or "Managed" in it. I didn't find anything that was like what I want.

Does anyone know a faster way to toggle this setting?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我ぃ本無心為│何有愛 2025-01-28 13:35:38

您可以创建一个启动settings.json文件,看起来像这样:

{
  "profiles": {
    "NameOfYourCSharpProject": {
      "commandName": "Project",
      "nativeDebugging": true
    }
  }
}

我验证了您可以执行此操作,即使您的项目是.NET Framework;尽管您必须首先要将您的.csproj转换为SDK样式(如果还没有)。它应放入C#项目的属性目录中。

因此,如果您发现自己在想要的本机代码开/关之间切换,我想您可以在aunplionSettings.json.json文件中进行两个可执行项目,一个设置,而另一个则没有。并在启动项目之间切换。或类似的东西。

You can create a launchSettings.json file and it would look something like this:

{
  "profiles": {
    "NameOfYourCSharpProject": {
      "commandName": "Project",
      "nativeDebugging": true
    }
  }
}

I verified you can do this even if your project is .Net Framework; though you'll have to first you want to convert your .csproj over to SDK style if it isn't already. It is to be put in the Properties directory of your C# project.

So if you find yourself toggling between wanting Native Code Debugging on/off I suppose you could make two executable projects one with this setting in the launchsSettings.json file and the other without. And toggle between start-up projects. Or something like that.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文