0

When I install for the first time the extension I want to see my toolbar without to activate it manually by right clicking on Visual Studio toolbar section and select my toolbar. I want to activate the toolbar just once, to inform the users about it's existence, but if it is manually disabled from VS then I want to keep it disable and use VS user settings.

My code from .vsct file is :

<Menu guid="guidPackageCmdSet" id="Toolbar" type="Toolbar">
  <CommandFlag>DefaultDocked</CommandFlag>
  <Strings>
    <ButtonText>My Toolbar</ButtonText>
    <CommandName>My Toolbar</CommandName>
  </Strings>
</Menu>

<Group guid="guidPackageCmdSet" id="ToolbarGroup" priority="0x0000">
  <Parent guid="guidPackageCmdSet" id="Toolbar" />
</Group>

<GuidSymbol name="guidPackageCmdSet" value="{498fdff5-5217-4da9-88d2-edad44ba3874}">
  <IDSymbol name="Toolbar" value="0x1000" />
  <IDSymbol name="ToolbarGroup" value="0x1050" />
</GuidSymbol>
Ionut Enache
  • 461
  • 8
  • 22
  • What is the exact name of VS project type you used? What have you tried so far? – vorou Dec 28 '17 at 16:37
  • This is the first time when I'm asking something, I am sorry if I was unclear. The exact name is **VSIX Project**, it can be found under the New Project -> Visual C# -> Extensibility section. I have tried different `` options like `AlwaysCreate` but they did not work. I do not know what else I could try. – Ionut Enache Dec 29 '17 at 17:37
  • Possible duplicate of [Show a Visual Studio Extension Toolbar by default](https://stackoverflow.com/questions/11035795/show-a-visual-studio-extension-toolbar-by-default) – vorou Dec 31 '17 at 07:04
  • @Ionut Enache, Could you get useful information from vorou's suggestion? – Jack Zhai Jan 04 '18 at 05:38
  • The vorou's suggestion was very good, thank you! Now my toolbar is showed every time when the VS is running, but if I explicitly disable the toolbar when I will start again VS then the toolbar will be activated. I am trying to activate the toolbar just once, to inform the users about it's existence, but if it is manually disabled from VS then I want to keep it disable and use VS user settings. – Ionut Enache Jan 08 '18 at 08:07

1 Answers1

0

What I did in the end was to store a hidden property using the attribute [Browsable(false)], with a default value set to true, in one of my Dialog Pages from extension and after the extension was installed for the first time I checked the property and I showed the toolbar as vorou's suggested in this link Showing a toolbar at Visual Studio startup and after that I changed the value for my property to false. Once the property was changed every time when a new instance of Visual Studio is started I checked the property but now nothing happens and Visual Studio will handle the toolbar just like the others. The bool property will be automatically preserved and it will never lose it's value. In this way the toolbar will appear after the installation but after that you can disable it and enable it again and the user setting will be preserved.

Ionut Enache
  • 461
  • 8
  • 22