For some reason, the Immediate window seems to be a never-ending subject for Microsoft treasure hunts. It seems like each new release of Visual Studio moves the Immediate window to a new location buried deep within the menu hierarchy. In some versions, it isn’t even present in the menus, so you need to resort to trickery to make it reappear.
There are a couple ways you can retrieve the Immediate window. The most straightforward is to scour the menu hierarchy looking for it. Unfortunately, the menus that you need are sometimes hidden. For example, you can find the Immediate window in Visual Studio 2017 by using Debug > Windows > Immediate. Unfortunately the Debug > Windows menu only contains the Immediate command if you have a project loaded. (It’s also annoying that the Immediate window cannot evaluate simple expressions such as 1 + 1 unless a project is loaded, but that’s a whole different rant.)
This almost makes sense because you can’t debug a project if you don’t have a project loaded. That doesn’t mean you can’t display the Immediate window, however. It just makes it harder to find.
This also violates a key principle of discoverable user interface design: don’t hide unavailable commands, disable them. That way the user can find the command and knows that it is unavailable. If you hide the command, users may waste a lot of time trying to find a command that they saw before but can’t find now.
Anyway, if you can’t find the Immediate window anywhere, you can try the following.
- Open the View menu.
- Open the Other Windows sub menu.
- Select Command.
- In the Command window, type “immed” and press Enter.
When you close and reopen Visual Studio, the Immediate window should still be visible. More on that in a moment.
You can also add the Immediate Window command to a menu. For example, in non-Express editions it appears in the Debug menu’s Windows submenu.
The exact details for customizing Visual Studio varies by version. In Visual Studio 2008 try these steps:
- Open the Tools menu.
- Select the Customize command to see the dialog shown above.
- On the Commands tab, select the Debug Category.
- In the Commands list, find the Immediate command and drag it into the toolbar or menu where you want to put it.
- (As long as you’re in there, you can look at the other commands that are available and place any that you think might be useful in menus or toolbars. Tip: Make new toolbar to hold your favorites.)
Now you can use the command in the toolbar to open the Immediate window when you want it.
There’s one more oddity that I want to talk about in this post. The first times I launched Visual Studio 2017, it told me that the Immediate window was taking 21 seconds to load and asked if I wanted to disable it at startup. I said yes and, as I expected, the next time I started Visual Studio 2017 it took just as long. The cause of the missing 21 seconds has nothing to do with the Immediate window. That’s just the window that Visual Studio opened just before it started doing something else that takes a long time. Lesson learned.
Unfortunately, now the Immediate window didn’t appear at startup and I couldn’t find an easy way to bring it back. I use that window a lot (does Microsoft ever use Visual Studio?), so that is a problem. (This is another classic Visual Studio user interface problem. It makes it easy for you to perform an action that is hard to undo.)
After much digging, I figured out how to restore the window. Select Help > Manage Visual Studio Performance to see the following dialog.
Select the Tool Windows branch, click on Immediate Window, and select Use Default Behavior. Now the window appears when you start Visual Studio.