Labs > Visual Studio Extension: Customize Visual Studio Window Title
This lightweight extension allows changing the window title of Visual Studio to include a folder tree with a configurable min depth and max depth distance from the solution/project file, and the use of special tags to help with many other possible scenarios (Git, Mercurial, TFS…).
Solution-specific overriding rules are available as well to cover virtually any possible renaming needs.
It can also be configured so that the rules apply only when at least two instances of Visual Studio are running with the same window title.
With default settings, SolutionFolder – Microsoft Visual Studio (Administrator) will be rewritten as SolutionFolderParent\SolutionFolder – Microsoft Visual Studio (Administrator)\*.
The following special tags are available:
- [documentName] Active document or, if no active document, window name;
- [projectName] Active project name;
- [startupProjectsNames] Startup project(s) name(s), separated with ‘ & ‘ if multiple;
- [startupProjectsNames:X] Startup project(s) name(s), separated with X if multiple (recommended values: ‘ & ‘, ‘, ‘ or ‘ | ‘ without quotes);
- [documentProjectName] Active document project name (if the document is part of a loaded project);
- [documentProjectFileName] Active document project file name (if the document is part of a loaded project);
- [solutionName] Active solution name;
- [documentPath] Active document full path or, if no active document, window name;
- [documentPath:X] Active document path element at the specified index (e.g. for C:\F1\Foo.cs, [documentPath:0] = C:\, [documentPath:1] = C:\F1);
- [documentPath:X:Y] Active document path segment over the specified range (e.g. for C:\F1\Foo.cs, [path:0:2] = C:\F1\Foo.cs, [path:2:0] = Foo.cs\F1\C:);
- [documentParentPath:X] Active document path parent element at the specified index (e.g. for C:\F1\Foo.cs, [parent:0] = Foo.cs [parent:1] = F1);
- [documentParentPath:X:Y] Active document path parent segment over the specified range (e.g. for C:\F1\Foo.cs, [parent:1:0] =F1\Foo.cs, [parent:0:1] = Foo.cs\F1);
- [env:X] Environment variable X for current Visual Studio process;
- [path] Current solution full path or, if no solution open, document full path or, if no active document, window name;
- [path:X] Path element at the specified index (e.g. for C:\F1\MySolutionFolder\MySolution.sln, [path:0] = C:\, [path:1] = C:\F1);
- [path:X:Y] Path segment over the specified range (e.g. for C:\F1\MySolutionFolder\MySolution.sln, [path:0:2] = C:\F1\MySolutionFolder, [path:2:0] = MySolutionFolder\F1\C:);
- [parentPath] Current solution path or, if no solution open, document path, with depth determined by « Farthest parent folder depth » and « Closest parent folder depth » settings;
- [parent:X] Path parent element at the specified index (e.g. for C:\F1\MySolutionFolder\MySolution.sln, [parent:0] = MySolution.sln [parent:1] = MySolutionFolder);
- [parent:X:Y] Path parent segment over the specified range (e.g. for C:\F1\MySolutionFolder\MySolution.sln, [parent:2:1] =F1\MySolutionFolder, [parent:1:2] = MySolutionFolder\F1);
- [ideName] Name of the IDE (e.g. Microsoft Visual Studio), including elevation suffix if applicable (e.g. » (Administrator) »);
- [elevationSuffix] Elevation suffix if applicable (e.g. » (Administrator) »), otherwise empty;
- [platformName] Current platform name (e.g. x86);
- [configurationName] Current configuration name (e.g. Release);
- [vsMajorVersion] Major version of Visual Studio (e.g. 11, 12, 14, 15…);
- [vsMajorVersionYear] Major version of Visual Studio, in year form (e.g. 2012, 2013, 2015, 2017…);
- [vsProcessID] Process ID of Visual Studio;
- [gitBranchName] Current Git branch name. Make sure Git’s executable directory is added to the Windows PATH variable or specify its location in settings;
- [hgBranchName] Current Mercurial branch name. Make sure Mercurial’s executable directory is added to the Windows PATH variable or specify its location in settings;
- [workspaceName] Team Foundation Server (TFS) workspace name of the currently loaded solution;
- [workspaceOwnerName] Team Foundation Server (TFS) workspace owner name of the currently loaded solution.
- [debuggedProcessesArgs] Arguments of the processes currently debugged (including the executable file name before each set of arguments if more than 1 process).
The symbol ‘\*’ will be added at the end automatically to identify that the title is being improved (can be configured in settings).
This is particularly useful when branching a solution/project: it becomes possible to easily identify which branch you are working on, in the case where both would have the same solution/project name.
It is possible to allow solution-specific settings overrides in two different ways:
- By enabling this option in the settings, and placing a ‘MySolution.sln.rn.xml’ file in the same directory as the MySolution.sln file to which it should refer to. The file should be in xml format containing a single CustomizeVSWindowTitle/SettingsSet element, which attributes can be the following:SolutionName, FarthestParentDepth, ClosestParentDepth, PatternIfDesignMode, PatternIfBreakMode, PatternIfRunningMode, AppendedString.
- By enabling this option in the settings, and specifying a « Global solution-specific settings overrides file path ». This file should be in xml format containing multiple CustomizeVSWindowTitle/SettingsSet elements as for .sln.rn.xml files, with the addition of a Path attribute or child node(s) to specify to which solution path or solution name each SettingsSet is applicable (wildcards are supported). Overrides from this global file take precedence over those found in .sln.rn.xml files.
If useful, patterns may therefore be completely hardcoded on a per solution basis.
To automatically generate and open such xml files, go to the « Solution-specific overrides » section of the extension settings. There, click on either the « Open solution config » or « Open global config » convenience buttons. The files will be pre-populated with your current configuration to make further customization easier, and will be opened for edition as any other code file right in Visual Studio.
All available tags are listed inside the extension settings in Visual Studio > Tools > Options… > Customize VS Window Title > Supported tags. They can also be easily inserted in each pattern field by clicking on the dropdown arrow at the right of each field, and then on the … yellow button.
Feature requests are welcome here. Official GitHub repository here. Contributions are welcome. More screenshots are available in this review by Sergey Vlasov.
You can install the extension from within Visual Studio directly or download the VSIX installable package from the Visual Studio Marketplace.
many thanks, exactly what I was looking for!!
First off. Thanks and great job!
Not sure if you’re aware (or care :)), but when no project is loaded, granted should rarely happen, the title bar fills with « – * – * – * – * ». Text find/replace issue?
Options:
False
1
1
2
False
Defaults for all the rest.
Just an update. The new version appears to fix starting with no solution running, but if you open a solution and then close it, the problem starts again. This is under 2010 with SP1; same settings as before. It never removes the solution path and then starts repeating « Microsoft Visual Studio (Administrator) * – » over and over. This was as of the version available 1/10/2013.
Again, thanks for the great extension. I can’t tell you how often it has helped me save time and be able to work more comfortably with multiple revisions.
thanks for the plugin. Could you do the same directory change in the recent projects? having multiple version of the same project means i have to hover over each one to see the proper directory….
thanks!
Can you give an option to not show the * after the title? My mind keeps telling me there are unsaved changes when I see that out of the corner of my eye 🙂
Great plugin, thanks!
This extension seems like just what I am looking for, but I really never did use an extension with options before. So I am a bit at a loss. Where and how do I set up the extension to show me the full path?
I need to see the full path to be able to differentiate, because I have Projects\Main\ and Projects\Release\.
Hi Inger Marie, you can adjust the options in « Tools » > « Options » > « Rename VS Window Title ». There you probably just need to play with the options labeled « Closest parent folder depth » and « Farthest parent folder depth ».
Cheers
Thanks a lot. It works! This add-on is a great help for me
This is a great extension. Love being able to set properties to get it to look just right for me.
Thanks.
Must have extension if you work with multiple source code branches. Thanks
After install VS 2012 Update 3, this extension is disabled. How can I re-enable it? The Enable button is disabled.
Hi Peter,
I do not have this problem. Maybe try to restart Visual Studio or your computer.
Best,
Erwin
When you have a query open (Team Explorer) it shows the ID of the query instead of the name…
I’m running VS 2013 (12.0.21005.1) with .NET Framework 4.5.50938 the activity log says « CreateInstance failed for package… » The extension won’t load. The error message is: Could not load file or assembly ‘Microsoft.VisualStudio.Shell.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified.
Any thoughts? Thanks!
I replied to you by email.
I just updated to version 2.6.0. I use VS 2010 10.0.40219.1 and after this update Rename VS Window Title extension stopped working. If I enable debug mode I’m getting this exception:
RenameVSWindowTitle: UpdateWindowTitle exception: System.IO.FileNotFoundException: Could not load file or assembly ‘Microsoft.VisualStudio.TeamFoundation.VersionControl, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified.
What can I do?
Thanks!
I’m running VS2012 but cannot laod your package. The Activitiy Log says:
CreateInstance failed for package [ErwinMayerLabs.RenameVSWindowTitle.RenameVSWindowTitle, RenameVSWindowTitle, Version=1.3.0.0, Culture=neutral, PublicKeyToken=ceec2b7720c0179d]
You mention above that you replied to a similar error message to a user named Toggle on Jan. 21, 2014, by email. Do you have a solution for this?
Thank you!
Hi Thomas,
I do not have such problem with a similar set-up (same VS version + .NET 4.5.51641).
Can you try on another machine maybe? Uninstalling and reinstalling the extension?
Are you running Visual Studio Express edition (it is not compatible with it)?
Uninstalling the extension and installing it again using a CMD box as administrator with the command
« C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\VSIXInstaller.exe » /quiet /admin D:\Downloads\RenameVSWindowTitle.vsix
did the job; the problem did not reappear even after rebooting the computer.
We are using the professional edition of VS 2012.
This is very useful! I encourage everyone to donate, as well.
Like John above, the asterisk puts me a little on edge, thinking I haven’t saved. Is there a way to eliminate that, or is it a by-product of modifying the title?
Also, Erwin, you commented on StackOverflow about how setting the title with the win32 api won’t work correctly. So how are you doing it? With the DTE model or?
Thanks!
Hi Matt, thank you for your donation! This is very much appreciated.
Actually it is already possible to configure the asterisk in the Options: just change the parameter « Appended string » to whatever you like (but it should be at least one distinct character).
To set the title, I am using the following piece of code, which you can also see in the Codeplex repository:
System.Windows.Application.Current.MainWindow.Title = "Hello world;
Cool, thanks Erwin. I changed my appended string to « 🙂 »
Great addin!!! Thanks.
Is it posible to add special tag for VS version (e.g. 2012, 2013, 2015CTP)? All modern VS vesions looks very similar and this is important (for me) to distinguish.
Hi Igor, it should be possible, but isn’t it sufficient to have a different icon for each version of Visual Studio?
Hi Erwin,
do you mean that 1) VS have different styles for icons or 2) that different VS versions don’t stack together on taskbar or 3) you wonder why I need to distinguish :)?
1) Icons of 2015CTP and 2013 looks me identical, 2012 also have pretty similar icon as far as I remember (I don’t have one currently).
2) I am very unorganized and have tons of visual studio’s open so I see 2 stacks with similar icons in taskbar.
3) 2015CTP has nice new features that I like to use with some projects but I still need 2013 for other project, sometimes I accidentally open project in a wrong version (or I just want to be sure before 10 minutes long build). My current solution is to press Alt+H,A to get the about window and if I could see it in title will save me additional 20 seconds a day 🙂
Thanks for plugin again.
Hi Igor, your wish has come true. I have just released a new version with support of the following tags:
– [vsMajorVersion] Major version of Visual Studio (e.g. 9, 10, 11, 12, 14…);
– [vsMajorVersionYear] Major version of Visual Studio, in year form (e.g. 2008, 2010, 2012, 2013, 2015…);
Enjoy. You now have 20 more seconds per day to make the world better :).
Cool, thank you 🙂
Hi Erwin,
Great plugin that makes my life a lot easier, but v2.8.1 crashes on startup with my vs2012 installation.
From the ActivityLog.xml file:
76 ERROR CreateInstance failed for package [ErwinMayerLabs.RenameVSWindowTitle.RenameVSWindowTitle, RenameVSWindowTitle, Version=1.3.0.0, Culture=neutral, PublicKeyToken=ceec2b7720c0179d] {5126C493-138A-46D7-A04D-AD772F6BE159} 80070002 VisualStudio 2015/05/04 06:24:12.602
77 ERROR End package load [ErwinMayerLabs.RenameVSWindowTitle.RenameVSWindowTitle, RenameVSWindowTitle, Version=1.3.0.0, Culture=neutral, PublicKeyToken=ceec2b7720c0179d] {5126C493-138A-46D7-A04D-AD772F6BE159} 80004005 – E_FAIL VisualStudio 2015/05/04 06:24:12.602
My post was just a little too quick 🙂
Fixed it by reinstalling as admin, as suggested by Thomas on march 24, 2014. Can you get the installer to ask for admin rights perhaps?
Hi Ronald, did you install the extension by downloading the VSIX as a file instead of from the extension manager within Visual Studio? It seems to be the same problem as the one described here:
http://blogs.telerik.com/telerik_vsxteam_blog/posts/11-05-02/vsix-package-deployment-and-users-in-the-same-machine.aspx
Not sure if there is anything simple I could do as I have no control over the VSIX installer (and admin rights are not theoretically required).
hi Erwin,
this is a great extension, thank you.
I have a folder structure like this:
DEV branch: C:\OnePlace\DEV\WebSite (folder contains .sln file)
STAGE branch: C:\OnePlace\STAGE\WebSite (folder contains .sln file)
I would like to display title like this: « OnePlace DEV », or « OnePlace STAGE ». basically I need to include parent.parent folder, in this case DEV or STAGE
is that possible? thank you
hi Erwin
Looks like the [workspaceName] tag may no longer be working in 2.8.2 (in VS 2012)
I just installed 2.8.2 and it is no longer working for me!
thanks
Hi Graham, thanks for your feedback. I have sent you an email.
Not working for me (VS 2013), the same issue as Graham!
Hi Bash, have you tried version 3.0?
Thanks Erwin, this is really handy for me as I’ve multiple branches and was sick of making mistakes as to which branch I was in or having to check the file properties.
Love it. Just started with the pattern: « [solutionName] in [parent3]/[parent2] », since I am using a two-level branch naming convention.
This use to be working fine but recently in VS 2015 Pro it gets disabled automatically. If I enable it appears to work and then at some random time (restart of VS it gets disabled again).
Currently installed version is 3.3.5 on VS v14.0.25431.01 Update 3.
Same problem. VS Enterprise 2015 (v14.0.25431.01 Update 3). On restart of VS it gets disabled.
Thanks. I have been looking for a way to identify the GIT branch that I am working on. This does what I need.
I hope that a 2017 compatible is either in the works or planned.
Same problem. VS Enterprise 2015 (v14.0.25431.01 Update 3). On restart of VS it gets disabled.
Hi Beat,
Do check the following question (and solution) on StackOverflow, it seems related to a similar issue:
http://stackoverflow.com/questions/35203647/updating-visual-studio-2015-extensions-end-up-disabled
Let me know if you still encounter problems as there is nothing in the latest releases that could be causing such behavior (all exceptions are caught and simply printed in the logs visible in the Output window).
Hi Mike, yes, a 2017-compatible version will be released before RTM.
Simple yet brilliant. This should have been released as part of Visual Studio. Thank you.
Hi,
is there a way to show TFS branch?
Thanks
Richard
@Richard, see this Github issue: https://github.com/mayerwin/vs-customize-window-title/issues/7
Erwin,
Thanks we are just getting into using TFS branching so very glad you made this extension available! A co-worker asked if there might be a way (future version) to change the Visual Studio color theme depending on some rule like if branch contains \Main\ one color and \Dev\ another color. We configure our IBM midrange terminal sessions similarly so we easily know if we are logged onto the development server or the production one. The title is great and will work but the color theme would be totally awesome!
@Bill, unfortunately as per https://stackoverflow.com/questions/31377442/changing-color-theme-within-a-visual-studio-extension the color scheme doesn’t seem to be exposed as a property. I just tried again with VS2017 and it is not better supported. It is certainly not impossible (see the SO answer about importing and exporting settings), but it’ll likely be slow to apply anyway, and it seems the color scheme is shared across ALL opened instances of Visual Studio (you can try changing the setting yourself to see), so I don’t think it will have much value. Thanks for the suggestion anyway.
Hi Erwin,
The asterisk seems to be out of place: My title bar reads « RootDir\SolutionName – Microsoft Visual Studio * ». Being at the very end, this asterisk gives the impression that I have unsaved work. Assuming this isn’t the intention, perhaps this is something you could look into fixing at some point?
Thanks for the helpful extension!
-Ted
Hi Ted, the symbol at the end (which is necessary to be able to identify window titles which have been rewritten) can be customized to whichever other symbol you might prefer in the extension settings :).
Hi,
I’ve been using your plugin for years but it looks like it doesn’t work for VS 2019.
Thanks,
Dominik
Hi Dominik,
Thanks for your message. VS 2019 was supposed to even remove the whole title bar (many complained, not sure if it’ll be back or not), so I have not even tried to check compatibility yet. I am waiting for the first RC to come out as previews are notoriously unstable and subject to change. But PRs are always welcome if you test it and manage to make it compatible!
Thanks for this tool … I love it. Sadly, the update yesterday blew away all my settings. It took some time figure it all out again. I’ll turn off « Automatically update this extension » from now on.
Thanks again for the extension!
Hi Dan, can you try updating again to the latest version? It should hopefully bring back your settings. I had updated a namespace while refactoring, and it seems it has caused the settings not to be deleted but considered as different ones, hence what you’ve seen. So I have reverted the namespace and it should take care of it. Do let me know if it indeed resolves your issue!
Hi Erwin,
i just installed the latest version on VS2019 RC2. It seems not to work. No matter which folder depth i configure, only the solution name is displayed.
Hi Klaus, VS 2019 RC2 does not display the title bar, so it won’t work. What you’re seeing is only the solution name, and AFAIK there is no way to change it. However Microsoft has said it’ll be possible to re-enable the title bar again in the first GA release coming next month. See this thread for more details: https://developercommunity.visualstudio.com/idea/381901/do-not-remove-title-bar-from-visual-studio-2019.html
Would it be possible to add a [gitRepositoryName] tag?
Hi Wim, it’d be best to submit this feature request in Github. Isn’t the repository name usually the same as the solution name?
Hi Erwin, it’s not working on vs2019… 🙁
Personally I like the vs2019 « no title bar » feature , is it possibile to customize the displayed solution name?
Hi Andrea, it is actually working in VS 2019, you just need to enable the title bar in the options. AFAIK it is not trivial to customize the displayed solution name.
This add-in is great and solves a big problem with identifying which branch is loaded!
Thanks!
Very useful!
Thanks.
Even though this extension can’t alter the displayed solution in VS2019, it does still affect the window title that shows up when switching applications/instances. So it’s less useful than it used to be (if you don’t want to enable the title bar), but still worth having.
Hopefully, at some point Microsoft will provide a hook to change the displayed solution, as well.
Cool update! There is no more tfsBranchName.
Hi Igor, what do you mean with « there is no more tfsBranchName »?
Hi Erwin,
very nice Plugin! Helps me keeping track of the current workspace and solution when working with different VS instances.
Displaying the current TFS changeset number would put the cherry on the cake.
But still, excellent work!
Is it possible to use the path specifier parameter with `gitBranchName` so I can strip off the leading parts of the path (if there are any).
i.e.
[gitBranchName] = dave/prototype/test-1
[gitBranchName:0] = test-1
@David, it is not possible at the moment, but feel free to submit a pull request on GitHub (or add this as a feature request). Shouldn’t be too hard to implement by reusing the same logic as for other paths.
There’s what you can do to make it work on vs2019:
https://stackoverflow.com/questions/53636350/re-enable-title-bar-in-visual-studio-2019
Hi Erwin!
Love the plugin. If it’s not too much effort: could you also make a 64bit build of it so it can be used in VS2022? I miss it 🙁
@Joris, yes planning to release a version for VS 20222 by the end of the year.
Any chance of making the source available?
@Sam, the source code is available here: https://github.com/mayerwin/vs-customize-window-title