Archive

Posts Tagged ‘Friendly Name’

Friendly visual studio solution names for working with multiple branches

April 29th, 2011 7 comments

If you have the latest version of the Visual Studio 2010 extension VSCommands you can give your solutions friendly names that display in the window’s title bar.  This is nice when you are working in different branches, so that you can differentiate which solution you are actually looking at.  I wrote the following regex to put the Branch Name after the Solution name, so for example if you have the client solution open in both Dev and Release, one will be called “Client.sln – Dev” and the other “Client.sln – Release”.

To use this, in Visual Studio go to Tools -> Options -> VSCommands 2010-> IDE Enhancements and then paste in the following (without the quotes):

Friendly Name: “{solutionName} – {branchName}”

Friendly Name – Solution Path Regex: “.*\(?<branchName>.*)\(?<solutionName>.*(?:.sln))”

    WindowTitle1

WindowTitle2

Happy coding!

— Update —

Here is the new regex that I prefer to use instead now which shows the directories that the solution is sitting in:

Friendly Name: “{solutionName} – {dir1}{dir2}{dir3}”

Regex: “.*\(?<dir1>.*)\(?<dir2>.*)\(?<dir3>.*)\(?<solutionName>.*(.sln)Z)”

— Update 2 for VS 2012 —

These are the settings that I like to use for VS Commands 11 for VS 2012:

Branch Name Regex: “.*\(?<dir1>.*)\(?<dir2>.*)\(?<branchDirectoryName>.*)\(?<solutionFileName>.*(.sln)Z)”

Branch Name Pattern: “{branchDirectoryName} Branch”

Git Branch Name Pattern: “{git:head} Branch”

Main Window Title Pattern: “{solutionFileName} – {dir1}{dir2}{branchDirectoryName} ({sln:activeConfig}|{sln:activePlatform})”

Solution Explorer Window Title Pattern: “ – {solutionFileName} • {vsc:branchName}”