Visual Studio output window- what goes there and why? - visual-studio

Can someone please explain to me what goes to the Output window in VS? Where do the messages there come from and do they have other use other than for debbuging?
Thanks.

The Output window is a set of text panes that you can write to and read from. Visual Studio defines these built-in panes: Build, through which projects communicate messages about builds, and General, through which Visual Studio communicates messages about the integrated development environment (IDE). Projects receive a reference to the Build pane automatically through the IVsBuildableProjectCfg interface methods, and Visual Studio offers direct access to the General pane through the SVsGeneralOutputWindowPane service. In addition to the built-in panes, you can create and manage your own custom panes.
Output Window (Visual Studio SDK)

This panel shows the actual info, that is spit from your application to the console (no matter debug or run mode). Also building, rebuilding and cleaning your project is described as operations there.
Check F1 for more info ;)

By default it either shows output from the build process, or debugger output. You can use OutputDebugString to display text in the output window while debugging.
There's not much else you can do with it without using an Add-In for Visual Studio.

Related

Have Visual Studio output window color messages according to log level?

When running an app in Visual Studio I love having colored messages in the console window. But is it possible to have colors showing in the Output window as well? Right now it's all monochrome.
Try this extension. I used it for VS 2022 and works really good. You can even configure which color you want to see.
link for VS2022 marketplace - VSColorOutput64
Link for another extension - Output enhancer

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

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?
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

Visual Studio 2019: Start Page instead of Start Window

Visual Studio introduced a blocking Start Window instead of a non-blocking Start Page.
Considering how extensible Visual Studio is, is there a way to have VS2019 display a non-blocking Start Page.
The new Start Window is quite annoying, less informative, displays all projects, not just solutions, pinning is not up to previous standards, and no additional information. Most annoying is the blocking aspect.
I am thinking that there is some sort of extension or setting that Microsoft has somewhere, which can re-enable the Start Page and disable the Start Window.
Alternatively if it is not possible, is it possible to just disable the start window and have the main application appear, when the app starts or when a user closes a solution/project?
--
Another hope with this post is that Microsoft sees this request and maybe modifies their code and offers users an option at the start, much like color theme and default code set, as to whether they want app blocking or app non-blocking for the start area.
In Tools > Options > Environment > Startup > On startup, open: select "Empty environment".
Visual Studio will start without showing the modal Start Window.
Start Page on startup extension restores the traditional Start Page in VS 2019.
Start Page: Please give it back! and Make the Visual Studio 2019 start window non-modal are open issues concerning your other points.

How to programmatically drop a file on a Windows app?

I'm looking to have a particular running instance of Visual Studio open a file. Is there a way I can fake a drag-drop operation via code from my app to Visual Studio? Same as if I were to drag a file from Explorer into VS.
I realize I could probably do this easier as an add-in or macro but I'm looking to make this work purely from a script.
You could try sending a WM_DROPFILES message to the Visual Studio window.

Debug multiple copies of a program from one Visual Studio instance

I have a pre-alpha GUI program that I'm dogfooding and want to run under the debugger (for when things go wrong ;), but I don't want to have to launch a new copy of Visual Studio for each instance of the application. Can this be done?
I don't expect to actually be debugging more than one instance at a time, but I still want the debugger in the look for all of them. Also, I'm starting the application a few dozen time a day, so it would have to be easy to do.
You can start an instance of the same, or different projects multiple times in one instance of Visual Studio. Here is how: Right click on any project in Solution Explorer, go to the Debug context menu item, and click Start new instance.
You can view and manipulate all your running processes from the Processes window (menu Debug → Windows → Processes). The menu item (and the Processes window) is only available when the application is running (under Visual Studio).
This can be done.
If you have the Professional version of Visual Studio, you can use it to attach to each instance of the application that you have open.
First, compile the application with debug information so that it can actually be debugged.
Then launch your application. Open as many instances as you need.
In Visual Studio, click menu Debug → Attach to Process.... Select the process(es) you want to debug. You can select more than one from the list by Shift + clicking or Ctrl + clicking them.
I've just tested this to make sure. One instance of Visual Studio (at least Visual Studio 2008) can debug multiple instances of the same application.
If you don't have the Professional version I don't think this can be done. I'm absolutely sure the Express version can not attach to processes. I'm not sure about what "paid" editions can attach to processes though it is possible to do.

Resources