An ADR Visual Studio Tool – Part 6 – Visually Opening Files and Changing the Command Title

February 25, 2020

Following on from this post, which is the latest in a series on creating a Visual Studio Extension, I’m covering a couple of loose ends.

Visually Opening Files

In order to cause Visual Studio to open a file, you’ll need to call .Open on the ProjectItem; this returns a Window; if you then want this window to become visible, simply tell it so. All of this must be done on the UI thread:

            await Microsoft.VisualStudio.Shell.ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
            var window = originalProjectItem.Open();
            window.Visible = true;

Change the Command Title

When you create an extension, by default it gets the same name as the project with the word ‘Window’ appended to it; in my case, that was AdrWindow. In order to change that, have a look for the file:


In my case, that was:


For the default set-up, the button text will he here:

          <ButtonText>Adr Manager</ButtonText>


Profile picture

A blog about one man's journey through code… and some pictures of the Peak District

© Paul Michaels 2024