This blog post explains how get Visual Studio to use Windows Terminal to run and debug your projects rather than using the Windows console.
- Right-click project and select properties.
- Click the Debug tab.
- Create a new profile.
- Set Launch set to Executable.
- Set Executable to the full path to the Windows Terminal executable (maybe C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\wt.exe).
- Set Application arguments to dotnet.exe run -p <full path to .csproj file>.
- Set Working directory to the full path to the folder that contains the .csproj file.
In the Visual Studio toolbar, select the 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.
Here is an example of the result:
To debug, press Ctrl+Alt+P or click Debug and then Attach to Process, and then select our .NET process and click Attach.
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.
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: