none
Is there an event similar to IVsSccSolution.AddedToSourceControl for remove from source control? RRS feed

  • Question

  • I have referred to the sample at https://github.com/microsoft/VSSDK-Extensibility-Samples/tree/master/ArchivedSamples/Source_Control_Provider_Status_Bar_Integration to enhance my source control provider with the publish workflow.

    With this, my source control provider is listed as one of the options when the Publish/Add to Source Control button is clicked on the status bar.

    Once publish is complete, SccProviderService raises the AddedToSourceControl event defined by IVsSccSolution:

    public void AddProjectsToSourceControl(ref Hashtable hashUncontrolledProjects, bool addSolutionToSourceControl)
            {
                ...
    // Raise the event to inform the shell that the solution was added to Source Control AddedToSourceControl?.Invoke(this, EventArgs.Empty); }

    This removes options from the Add to Source Control button on status bar. If I were to additionally implement the other related interfaces like IVsSccCurrentRepository, this button will be replaced with those.

    My source control provider gives users a way to remove the solution from source control. But, once I do that and save the solution, the Add to Source Control button still remains in the same state (that is, no options), or in the case I have implemented IVsSccCurrentRepository, it doesn't switch back to  Add to Source Control.

    Is there a RemovedFromSourceControl event that I can raise to let the environment know that it should start showing the Add to Source Control status bar button with supported source control providers, just like it would if I were to close and open the solution? Any other way to achieve the same would help too.

    Thanks,
    Priya


    Thursday, July 4, 2019 6:49 AM

All replies

  • Hi Priyadarshini,

    Welcome to MSDN forum.

    I'm afraid the answer could be negative. As far as I know, there's no similar event can work like the AddToSourceControl event to file when  you remove the solution from source control.

    And to achieve your goal, you can check if IVSSccChanges interface could help.

    Best Regards

    Lance


    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.


    Friday, July 5, 2019 6:07 AM
  • Hi Lance,

    Can you please tell me how I can use IVsSccChanges to achieve what I want?

    Thanks,
    Priya

    Monday, July 8, 2019 6:01 AM
  • Hi Priya,

    The IVsSccChanges is something related to pending changes. But I have no direct experience how to use it.

    Actually i'm trying to involve someone more experienced in this topic(source control extension) into this thread, hope he can have a better idea. It may take some time and please be patient for it. Any update I will share here.

    Best Regards

    Lance


    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 8, 2019 10:30 AM
  • Sure, thank you! Can you also take a look at a related question at https://social.msdn.microsoft.com/Forums/en-US/02ba8d1b-16b4-4bc9-9800-9c79832da5e8?
    Monday, July 8, 2019 2:43 PM
  • Hi Priya,

    Sorry but for now I have no good idea about the issue in your shared link. 

    And for your original issue about the remove event:

    It seems what you're looking for is something we don't implement directly. Specially, a command or feature that allows you to remove SCC bindings. That would be a feature you need to provide/add yourselves. (So no Interface to achieve your goal directly)

    And this will be obviously different per SCC provider, so you will likely need to implement your own feature to unbind a project or solution from their SCC provider.

    Besides, to remove TFS or GIT bindings, the only way I know how to do this is to change the provider used to “None” in the Tools.Options dialog in VS menu, or nuke files and edit the .sln file directly.

    Hope all above can make some help for your issue. 

    Best Regards

    Lance


    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.

    Tuesday, July 9, 2019 6:05 AM

  • No, I wasn't looking for a feature that allows me to remove SCC bindings, I implement that. I was looking for an event that I can raise to tell the environment that bindings have been removed, and it should update the status bar, similar to the AddedToSourceControl event.
    Tuesday, July 9, 2019 3:14 PM
  • To workaround, I can reload the solution programmatically after removing the source control bindings. I know I can close and open the solution programmatically, but is there a way to just reload programmatically? Similar to what would happen if the solution was modified outside the environment?

    Thursday, July 11, 2019 6:54 AM
  • Hi friend,

    Sorry but I can't find any api related to solution-reload action, what we can find is something like load project method like ProjectCollection.LoadProject Method.

    See this issue: Reload project in VSX. 

    Best Regards

    Lance


    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.

    Thursday, July 11, 2019 9:40 AM