Use Windows Terminal for Visual Studio Run and Debug

This blog post explains how get Visual Studio to use Windows Terminal to run and debug your projects rather than using the Windows console.

  1. Right-click project and select properties.
  2. Click the Debug tab.
  3. Create a new profile.
  4. Set Launch set to Executable.
  5. Set Executable to the full path to the Windows Terminal executable (maybe C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\wt.exe).
  6. Set Application arguments to dotnet.exe run -p <full path to .csproj file>.
  7. Set Working directory to the full path to the folder that contains the .csproj file.
Visual Studio run/debug configuration

In the Visual Studio toolbar, select the profile.

Visual Studio select a run/debug profile

Now when you run or debug, Visual Studio opens a command prompt to launch Windows Terminal. To make this command prompt disappear immediately afterwards, click Tools, then Options, then Debugging, and then select Automatically close the console when debugging stops.

Visual Studio options

Here is an example of the result:


Windows Terminal

To debug, press Ctrl+Alt+P or click Debug and then Attach to Process, and then select our .NET process and click Attach.

Attach Visual Studio debugger to process

If you need to debug something that occurs at initialization, you can use a different debugging profile temporarily that lets Visual Studio run the .NET process directly and attach the debugger automatically.

Update 4.September.2021:

On this other, someone commented that this approach might not work if you download Windows Terminal through the Microsoft Store, as which does not use the wt.exe binary:

I responded that based on the following post on one of my other blogs:

I thought that the following might work:

explorer.exe shell:AppsFolder\Microsoft.WindowsTerminal_8wekyb3d8bbwe!App

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: