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:
[ProjectName]Package.vsct
In my case, that was:
AdrPackage.vsct
For the default set-up, the button text will he here:
<Strings>
<ButtonText>Adr Manager</ButtonText>
</Strings>