Visual Studio for Macでデバッグできないとき

LeetCodeやAtCoderが流行っているので久々にC#を書こうとしたら詰まったのでメモ。

  1. Visual Studio for Macをダウンロード
  2. .NET Coreをダウンロード
  3. Visual Studioで適当にConsole Appを作成
  4. Console.WriteLineにBreakPointを置いてデバッグ実行
Debugger operation failed 
launch: program '' does not exist.

f:id:suzusin:20190326194844p:plain

調べたところ、dotnetへのpathが通っていないとのことだった。

$ dotnet
zsh: correct 'dotnet' to 'done' [nyae]? n
zsh: command not found: dotnet
$ ln -s /usr/local/share/dotnet/dotnet /usr/local/bin
$ dotnet
zsh: correct 'dotnet' to 'done' [nyae]? n

Usage: dotnet [options]
Usage: dotnet [path-to-application]

Options:
  -h|--help         Display help.
  --info            Display .NET Core information.
  --list-sdks       Display the installed SDKs.
  --list-runtimes   Display the installed runtimes.

path-to-application:
  The path to an application .dll file to execute.

linkを貼ることで無事デバッグできるようになった。