Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to keep "new solution explorer views" after reload a project in Visual Studio 2015?

Every time I load my project I do organize my workspace into 3 "new solution explorer view". One Solution Explorer for the views folder, one for the models folder and the last one for the controllers folder.

However when I close and reopen my project it is set back to the default workspace. Is possible to keep those created solution explorer views ?

The Save workspace option don't work with multiples solutions explorers.

like image 863
Daniel Santos Avatar asked Aug 14 '16 15:08

Daniel Santos


3 Answers

Unfortunately, the short answer is "you can't". I have been attempting to find a solution utilising the MS Macro addin, and some of the other tools available, but none of them seems to be able to automate the opening of additional solution views, let alone a way of persisting them once they are set up.

I was quite surprised that the "Save Window Layout" feature in VS2015 doesn't allow you to do this either. It simply ignores any additional solution views. My theory on this is that, as the views are solution specific, it doesn't make sense to have them persisted as a default for the entire environment.

like image 52
Rich Linnell Avatar answered Nov 16 '22 02:11

Rich Linnell


Here is a rather dirty solution I came up with in the last hour. It uses an AutoHotKey script which does what you would do by hand. The case in the code is quite specific, since I want to open two panes on top of each other each one searching for a specific search term, but you can easily modify the code to suit your needs.


What I want to end up with

What I want to end up with

Usage

Have the solution Explorer on Docked Mode and on "Show all Files" view. Double click the script, which should have the ending .ahk with AutoHotKey installed. You have 2 seconds to Alt+Tab to Visual Studio, where the script will do it's thing. When it is done, close the original Solution Explorer by hand.

The Script

FolderPos           = 2 ; Position of Target Folder, Example in the picture below

XPosFirst           = 24 ; How many times to press right
YPosFirst           = 42 ; How many times to press down
SearchTermFirst     = "cpp" ; Text to search in the explorer

XPosSecond          = 22
YPosSecond          = 13
SearchTermSecond    = "hpp"

InitiateMove() {
    Send !{Space}
    Send M
}
NewSolutionExplorer() {
    Send {AppsKey}
    Send N
}

ExitSearch() {
    Send {Down}
    Send {Up 5}
    Send {Down}
}

BlockInput MouseMove
Sleep 2000

SetKeyDelay 10
Send ^!l
Send {Down %FolderPos%}

NewSolutionExplorer()
SetKeyDelay 80
InitiateMove()

Send {Right %XPosFirst%}
Send {Down %YPosFirst%}

SetKeyDelay 10
Send {Enter}
Send ^;
Send %SearchTermFirst%
ExitSearch()

NewSolutionExplorer()
SetKeyDelay 80
InitiateMove()

Send {Right %XPosSecond%}
Send {Down %YPosSecond%}

SetKeyDelay 10
Send {Enter}
Send ^;
Send %SearchTermSecond%
ExitSearch()

BlockInput MouseMoveOff
ExitApp

FolderPos Example: Folder src is on position 2

<code>FolderPos</code> Example: Folder src is on position 2

like image 20
Post Self Avatar answered Nov 16 '22 02:11

Post Self


For VS2017 and VS2019 I found extension 'Multiple Solution Explorer Tools'. Only problem - it does not maintain view windows position and size after load.

like image 1
basic Avatar answered Nov 16 '22 01:11

basic