none
Icon for my source control provider listed in the Publish/Add to Source Control menu on status bar? RRS feed

  • Question

  • When I run the sample at https://github.com/microsoft/VSSDK-Extensibility-Samples/tree/master/ArchivedSamples/Source_Control_Provider_Status_Bar_Integration, I do not see an icon next to the sample source control provider when I click Publish/Add to Source Control button on the status bar. I see one against the Git integration though.

    Managed Source Control Sample Provider (C#)

    Is there any property I can set on the ProvideSourceControlProviderAttribute or in the IVsSccPublish interface or any other way I can show an icon against the source control provider listed in the Publish/Add to Source Control menu on status bar?
    Thursday, July 4, 2019 8:35 AM

Answers

  • Hi Priyadarshini,

    Unfortunately there isn't a way to add icons to the menu items for the 3rd party providers displayed in this particular menu. The GIT and TFS menu commands which are listed in the top menu group (above that menu divider) are actually implemented as individual menu commands defined in an internal VSCT menu resource. So they can actually have an icon associated with them. For example:

    <Button guid="guidSccDisplayInformationCommandSet" id="cmdidGit" priority="0x0000" type="Button">
    <Parent guid="guidSccDisplayInformationCommandSet" id="MicrosoftPublishGroup" />
    <Icon guid="ImageCatalogGuid" id="Git"/>
    <CommandFlag>IconIsMoniker</CommandFlag>
    <CommandFlag>DynamicVisibility</CommandFlag>
    <Strings>
    <ButtonText>&amp;Git</ButtonText>
    </Strings>
    </Button>

    However, the item(s) listed below that group divider (Like that Managed Source Provider, or even the AnkSVN (Subversion Provider) are dynamically generated menu items, which don't have the ability to specify an icon resource.  

    <Button guid="guidSccDisplayInformationCommandSet" id="cmdidPublishStart" priority="0x0200" type="Button">
    <Parent guid="guidSccDisplayInformationCommandSet" id="NonMicrosoftPublishGroup" />
    <CommandFlag>DynamicVisibility</CommandFlag>
    <CommandFlag>DynamicItemStart</CommandFlag>
    <CommandFlag>DefaultInvisible</CommandFlag>
    <CommandFlag>TextChanges</CommandFlag>
    <Strings>
    <ButtonText>Publish</ButtonText>
    </Strings>
    </Button>

    Menus created using DynamicItemStart don't support the Icon CommandFlag. So unfortunately, there isn't a way to add an icon, to the menu item(s) you see using this particular command.

    Sincerely,
    Ed Dore
    Microsoft Developer Support


    Ed Dore

    Monday, July 15, 2019 10:31 PM
    Moderator

All replies

  • Hi Priyadarshini,

    Thanks for posting here. We will investigate this question and you can also open an issue at the repo microsoft/VSSDK-Extensibility-Samples.

    Thanks,

    Charles


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, July 15, 2019 11:16 AM
  • Hi Priyadarshini,

    Unfortunately there isn't a way to add icons to the menu items for the 3rd party providers displayed in this particular menu. The GIT and TFS menu commands which are listed in the top menu group (above that menu divider) are actually implemented as individual menu commands defined in an internal VSCT menu resource. So they can actually have an icon associated with them. For example:

    <Button guid="guidSccDisplayInformationCommandSet" id="cmdidGit" priority="0x0000" type="Button">
    <Parent guid="guidSccDisplayInformationCommandSet" id="MicrosoftPublishGroup" />
    <Icon guid="ImageCatalogGuid" id="Git"/>
    <CommandFlag>IconIsMoniker</CommandFlag>
    <CommandFlag>DynamicVisibility</CommandFlag>
    <Strings>
    <ButtonText>&amp;Git</ButtonText>
    </Strings>
    </Button>

    However, the item(s) listed below that group divider (Like that Managed Source Provider, or even the AnkSVN (Subversion Provider) are dynamically generated menu items, which don't have the ability to specify an icon resource.  

    <Button guid="guidSccDisplayInformationCommandSet" id="cmdidPublishStart" priority="0x0200" type="Button">
    <Parent guid="guidSccDisplayInformationCommandSet" id="NonMicrosoftPublishGroup" />
    <CommandFlag>DynamicVisibility</CommandFlag>
    <CommandFlag>DynamicItemStart</CommandFlag>
    <CommandFlag>DefaultInvisible</CommandFlag>
    <CommandFlag>TextChanges</CommandFlag>
    <Strings>
    <ButtonText>Publish</ButtonText>
    </Strings>
    </Button>

    Menus created using DynamicItemStart don't support the Icon CommandFlag. So unfortunately, there isn't a way to add an icon, to the menu item(s) you see using this particular command.

    Sincerely,
    Ed Dore
    Microsoft Developer Support


    Ed Dore

    Monday, July 15, 2019 10:31 PM
    Moderator
  • Thanks for the details, Ed. May I request your help on a related issue?

    Basically, I want to implement just IVsSccPublish, and not IVsSccChanges, IVsSccCurrentBranch, IVsSccCurrentRepository and IVsSccUnpublishedCommits. I see the documentation at https://docs.microsoft.com/en-us/visualstudio/releasenotes/vs2015-update2-vs#version-control says "If one of the compartments doesn’t apply, a provider can choose to leave that compartment out of their implementation and it will be hidden from the status bar."

    Once publish goes through, I raise the AddedToSourceControl event defined by IVsSccSolution. With that the options from the Publish status bar button go away, but the button itself stays. I have raised an issue at https://developercommunity.visualstudio.com/content/problem/633138/ivssccsolutionaddedtosourcecontrol-event-does-not.html

    Also, my source control provider has a "Remove from source control" option, but there is no way I can tell Visual Studio to show the Publish status bar button when I do that. Asked a question at https://social.msdn.microsoft.com/Forums/en-US/c1ab1114-710a-47e3-818e-6aa1ad1b6ba8/is-there-an-event-similar-to-ivssccsolutionaddedtosourcecontrol-for-remove-from-source-control?forum=vsx

    To workaround, I can reload the solution programmatically after adding/removing the source control bindings. I know I can close and open the solution programmatically using IVsSolution.CloseSolutionElement and IVsSolution.OpenSolutionFile, but is there a way to just reload programmatically? Similar to what would happen if the solution was modified outside the environment? Or is reload the same as close and open?

    Thank you!

    Wednesday, July 17, 2019 12:45 PM