VS2008:在调试时启动外部程序

发布于 2024-08-10 20:38:48 字数 382 浏览 3 评论 0原文

我有一个包含三个项目的解决方案:

  1. 是一个用于通过串行端口连接的设备的控制台(GUI 应用程序)。
  2. 串行端口模拟(控制台应用程序、自托管 WCF 服务)。
  3. 通用接口。

为了进行调试,我启动 SerialPortEmulator,然后调试 (F5) 主项目。

两个问题:

  1. 启动模拟器需要额外的击键。
  2. 我需要记住在编译之前停止模拟器(以防发生重大更改)。

问题:理想情况下,我希望模拟器项目在调试时启动,并在调试停止时终止。有简单的方法吗?

我可以在不同的解决方案中使用模拟器,但随后我需要确保接口定义库始终保持同步。

I have a solution with three projects:

  1. is a console (GUI app) for a device connected through Serial Port.
  2. Serial Port emulation (console app, self-hosted WCF service).
  3. Common interfaces.

To debug, I start SerialPortEmulator and then debug (F5) the main project.

Two problems:

  1. It takes extra keystrokes to start the emulator.
  2. I need to remember to stop the emulator before compiling (in case there are breaking changes).

Question: Ideally I want to have emulator project be started on debug, and terminated on debug-stop. Is there easy way to do that?

I could have the emulator in a different solution, but then I need to ensure the interfaces definition library is always in sync.

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

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

发布评论

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

评论(1

娇妻 2024-08-17 20:38:48

您可以尝试编写一个宏来捕获 OnEnterRunMode

Private Sub DebuggerEvents_OnEnterRunMode(ByVal Reason As EnvDTE.dbgEventReason) _
    Handles DebuggerEvents.OnEnterRunMode

    // Run emulator here
End Sub

至于停止的清理,看看我的 上一个答案(调试停止时执行清理代码)

You can try to write a macro to catch the OnEnterRunMode

Private Sub DebuggerEvents_OnEnterRunMode(ByVal Reason As EnvDTE.dbgEventReason) _
    Handles DebuggerEvents.OnEnterRunMode

    // Run emulator here
End Sub

As for the clean of stop, have a look at my previous answer (Executing clean up code when debugging stops)

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