Attach to dot net core running from CLI

January 16, 2017

For Reference

If you're running your dot net core web application from the command line interface (cli)

dotnet run

then it is possible to attach your Visual Studio debugger to the running process. When the process starts up it's named dotnet.exe and is running under your username. You can add an additional parameter '-v' when launching run to get the process id output when started. Note that the -v has to written before run, not after run -v.

dotnet -v run

In Visual Studio, click the menu option Debug -> Attach to Process or Ctrl + Alt + P. Select your process by finding it by name and/or process id. Add your break points and debug!