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.
Related
Say I have one instance of Visual Studio running where I have opened few windows like Unit Test Explorer, Resharper TODO explorer and so on and to take advantage of multiple monitors I have moved these windows out of visual studio to different monitors.
Now if I open different solutions in new instances of Visual studio (say from Visual Studio > Recent items jump lists) all the new instances also open with similar windows in each instance, even though I don't really need those in those new instances. These clutter my work space and I have hunt and close these one by one.
This continues until I close all the news Visual studio instances, close all the windows on the first one instance I had and close that instance as well.
I understand this behavior stems from the fact that the new instances inherit the opened windows etc. configuration from the first opened instance.
Is there any way to prevent the same windows from opening on subsequent instances of visual studio?
Or may be a configuration to launch visual studio with default windows?
Or quick way to kill all these unwanted windows?
I looked through the VS > Options > Environment > Startup and Tabs and Windows etc., devenv.exe command lines but don't find anything useful.
While the solution provided by #Richard to establish your "baseline" window layout, then save that (Window | Save Window Layout) and apply the layout using Window | Apply Windows Layout | name or the assigned shortcut helped as a workaround, I see Microsoft Visual Studio 2019 now comes with a preview feature, Autohide tool windows at startup,
that addresses this problem.
When enabled, any new instances of Visual Studio open only Solution Explorer and not any other windows opened on previous instances. This also improves startup performance noticeably.
I recently upgraded to Windows 10 and Visual Studio 2019.
Prior to the upgrade, Visual Studio 2017 would always run as Administrator. I did not think much of this, but now that it is gone it is causing me problems.
The primary one is that it will not load my projects that use my local instance of IIS.
I usually launch Visual Studio from my start bar. Right now this goes like this:
Right click on the icon on the start bar and select my solution.
It loads and then I realize that the main project did not load.
Close visual studio, open as admin
Pick my solution and then it loads.
I would really like to only have to do #1 above. Is there someway I can edit the shortcut on the start bar to have it always launch as Administrator?
Turns out that Visual Studio uses different permissions when you click on the list of shortcut options it offers in the start menu. (IE to load a recent solution directly.)
Selecting the Properties->Advanced->"Run as Administrator" did not cause these to run as administrator.
But this did it:
Find devenv.exe (Visual Studio's executable)
Right Click on it and select "Troubleshoot Compatibility".
On the Program Compatibility Troubleshooter window, click on Troubleshoot Program
Check that the program requires additional permissions and click Next
On the next window, click on Test the program… and VS will open as administrator
Click next and then click on Yes, save these settings for this program
Now Visual Studio will ALWAYS run as administrator.
(Taken from: https://ppolyzos.com/2017/08/08/always-run-visual-studio-as-administrator/)
Anyone know why you cannot use Greenshot in Visual Studio? I hit the Screen Print button and it does not bring up the cross-hairs to drag my window size. Instead it just takes a plain windows screenshot. I looked for keyboard commands that might override it but didnt see anything at first glance. It works for every other program but not when Visual Studio is the active window.
It's because your visual studio is running in a higher level (permission wise) than your greenshot instance.
for a one time test, close Greenshot, and run it as administrator (right click on the file, run as administrator).
As a more permanent solution, you can just set the compatibility mode for the file to be run in admin mode, and then when it's started on start up it should capture your VS instances as well :).
Edit:
Just in case, you can easily figure out if anything else is wired to a shortcut by doing the following:
I regularly debug several projects contained in one solution using the same Visual Studio instance. For that, I use the "Debug"->"Start new instance" menu on each project I want to debug:
When using the menu "Debug"->"Stop debugging", all projects debug sessions are stopped.
How can I stop the debug session of one project only?
Bring up the Processes window (normally found under Debug -> Windows -> Processes), right click on the process you wish to stop debugging and slect either "Detach Process" (to stop debugging and leave the process running) or "Terminate Process" (to terminate the process)
(This screenshot is of Visual Studio 2012, however the dialog is very similar in previous versions of 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.