Archived post: posted sometime between 2016 and 2022.

Attach VS Code to dotnet test

First, run dotnet test from a terminal.

Then open the VS Code command palette.

Choose Debug: Select and Start Debugging .

Next choose .NET Core Attach .

Finally, attach to testhost.exe .

Woot!