locked
Add In: Open standard dialogs in Visual Studio RRS feed

  • Question

  • I'm writing a Visual Studio extension and would like to open the Connect to Team Foundation Server standard dialog on click.

    I was able to do so utilizing the DTE2.ExecuteCommand method like DTE2.ExecuteCommand("Team.ConnecttoTeamFoundationServer") but I feel that there must be a better way to do that then using Visual Studio macros.

    Any help is most appreciated. Thanks in advance!


    Friday, November 2, 2012 5:21 PM

Answers

  • Hey Ryan,

    I hope you are feeling better.

    Your input lead me to a solid conclusion.

    I was using Telerik's Just Decompile on core libraries and happened upon Microsoft.VisualStudio.TeamFoundation.CommandHandlerPackage. Which definitely showed me that the methods needed to perform that specific task (and a bunch of others), are only approachable through DTE Commands.

    Thanks.

    Saturday, November 3, 2012 1:38 PM

All replies

  • That isn't a macro, it is simply asking the shell to execute the same command it would when the user clicks on the Connect To Team Foundation Server menu item.

    Ryan

    Friday, November 2, 2012 5:42 PM
  • Thanks Ryan,

    Understood, but that part wasn't so much my problem...

    1. Is there a way to find out what method(s) (and on what interface(s)) is executed by the command?

    2. What method/interface is it that displays the "Connect to Team Foundatoin Server" menu?

    3. Is this the best way (or just an acceptable way) of going about things?

    -Stan

    Friday, November 2, 2012 6:17 PM
  • Generally I would say an API is the way to go, but that is primarily to avoid things like contextually available commands. In this case the command is global (i.e. doesn't rely on focus/selection). There may be a service driven way to raise it, I am home sick at the moment so I can't look what the command is doing. That said not every single command is calling into publicly exposed API.

    Ryan

    Friday, November 2, 2012 6:27 PM
  • Hey Ryan,

    I hope you are feeling better.

    Your input lead me to a solid conclusion.

    I was using Telerik's Just Decompile on core libraries and happened upon Microsoft.VisualStudio.TeamFoundation.CommandHandlerPackage. Which definitely showed me that the methods needed to perform that specific task (and a bunch of others), are only approachable through DTE Commands.

    Thanks.

    Saturday, November 3, 2012 1:38 PM
  • Hi stanley,

    I’m glad to hear that you got it working.

    Thank you for sharing your solutions & experience here. It will be very beneficial for other community members who have similar questions.

    Best regards,


    Ego [MSFT]
    MSDN Community Support | Feedback to us

    Monday, November 5, 2012 9:33 AM
  • Hi, Although the question is answered already, thought to highlight alternative approache mentioned in the below blog post. The approach is much cleaner.

    http://geekswithblogs.net/TarunArora/archive/2011/06/18/tfs-2010-sdk-connecting-to-tfs-2010-programmaticallyndashpart-1.aspx


    Regards,
    Utkarsh
    Blog | Twitter

    Thursday, July 24, 2014 4:28 PM