【问题标题】:How to run application from Visual Studio in Mac terminal如何在 Mac 终端中从 Visual Studio 运行应用程序
【发布时间】:2021-10-03 08:03:37
【问题描述】:

我正在 Mac 上的 Visual Studio 8.9.10 中开发 netcore 3.1 控制台应用程序。 运行它时,应用程序会在 Visual Studio 本身的终端窗口中执行。

当我单击运行按钮时,我希望它在 mac 终端中运行。 我在项目选项中找不到正确的设置 - 没有像“在外部控制台上运行”之类的复选框。

提前谢谢你。

【问题讨论】:

    标签: visual-studio-mac


    【解决方案1】:

    Visual Studio for Mac 可以配置为使用首选项 - 其他 - 终端中的 macOS 终端应用程序。取消选中“启用集成终端”以使用外部 macOS 终端应用程序。

    【讨论】:

      【解决方案2】:

      我不肯定这是唯一的方法,但我的猜测是,将调试器附加到从终端启动的程序是目前唯一的方法。

      类似这样的:https://stackoverflow.com/a/552788

      为了方便和后代复制这里:

      using System;
      using System.Diagnostics;
      using System.Threading;
      
      namespace DebugApp
      {
          class Program
          {
              static void Main(string[] args)
              {
                  Console.WriteLine("Waiting for debugger to attach");
                  while (!Debugger.IsAttached)
                  {
                      Thread.Sleep(100);
                  }
                  Console.WriteLine("Debugger attached");
              }
          }
      }
      

      【讨论】:

        猜你喜欢
        • 2020-07-31
        • 1970-01-01
        • 1970-01-01
        • 2020-09-26
        • 2015-05-25
        • 1970-01-01
        • 2015-07-09
        • 2020-12-14
        • 2012-02-13
        相关资源
        最近更新 更多