Search code examples
visual-studio-2015visual-studio-extensionsvisual-studio-2017

Changing the title of the Solution Explorer tool window in visual studio 2015


In visual studio, in the Solution Explorer you can right clock and select "New Solution Explorer from here" enter image description here Then a new Solution explorer tool window open - but it has the same name "Solution Explorer" - and no way to reflect the folder it represents or anything.

If I want to use multiple solution explorer windows - it'll be best if I can determine a name for them - or if their name would be representative of the root item they refer to.

Is there a visual studio extension that does that?


Solution

  • You can the title value via the property named caption. Here is a simple demo for your reference.

     DTE2 dte = (DTE2)this.ServiceProvider.GetService(typeof(DTE));
                List<Window> list = new List<Window>();
                foreach (Window w in dte.Windows)
                {
                    if (w.Caption == "Solution Explorer")
                    {
                        list.Add(w);
                    }
                }
    
                for (int i = 0; i < list.Count; i++)
                {
                    list[i].Caption = "Test" + i;
                }
    

    enter image description here