How to clear the output window in Visual Studio 2022 before each run automatically

Viewed 283

I have a simple .NET Core 6 application, developed via Visual Studio Community 2022.

When I press the start button in the standard toolbar, it appends the logs in the output window.

If I want to distinguish the start point of the recent run in the log's lines, I must search in the console.

There is a button in the top corner of the output window for clearing the console before the next run.

My question is, is there any setting in Visual Studio that I can set, to clear this output window automatically in each run before starting logging?

enter image description here

1 Answers

Here's my cheat-to-win workaround. It's not exactly the same as clearing the output window but it sure gets rid of the noise.

Debug.WriteLine(string.Join(Environment.NewLine, Enumerable.Repeat(string.Empty, 100)));

In the past I would use the technique shown here EnvDTE80.DTE2 to do a legitimate Clear but apparently there's no support for System.Runtime.InteropServices.Marshal.GetActiveObject in net core as mentioned here .Net Framework but not for .Net Core

Related