How do I make Visual Studio use the GUI same layou

2020-03-01 08:21发布

问题:

Visual Studio uses two different GUI layouts depending on whether or not your code is running. I understand the purpose of this (letting you only show debugging-related windows while you're actually debugging) but I find this feature annoying and would prefer the same layout be used while both debugging and not.

Is it possible to disable this feature and, if so, how?

回答1:

Interesting timing. Zain Naboulsi just wrote a few posts about this in the Visual Studio Tip and Tricks blog:

  1. Window Layouts: The Four Modes
  2. Window Layouts: Design, Debug, and Full Screen
  3. Window Layouts: File View

The thing to remember here is that, both, your tool windows and your command bar customizations are saved separately for each state. There is no way to tell Visual Studio to use one state for all modes at this time. Additionally, when you shut down Visual Studio in any state, all four states are saved.

EDIT

Disclaimer: I haven't tried this myself, but it look promising. If you export your Visual Studio settings and edit the resulting file with a text editor, you can find a <Category name="Environment_WindowLayout"> element with child elements for each layout. I would guess that copying <Design> into the <Debug> would result in both layouts being identical. Maybe someone can write a VS add-in or external utility to automate this :)

Here is a simplification of what the relevant settings XML layout looks like:

<UserSettings>
    <Category name="Environment_Group" ...>
        <Category name="Environment_WindowLayout" ...>
            <NoToolWin>
                ...
            </NoToolWin>
            <Design>
                ... 
            </Design>
            <Debug>
                ...
            </Debug>
            <Design-FullScreen>
                ...
            </Design-FullScreen>
        </Category>
    </Category>
</UserSettings>


回答2:

As far as I know, there is no way to change this behavior. However, what I do is set them both up to be the same (set up the windows twice; once while writing code and once while debugging) and there will be no change in appearance.