How to load a project from a Tool Window extension? RRS feed

  • Question

  • I've written a Tool Window extension for VS 2017. It interfaces with our internal code repository. How can I tell the current instance of Visual studio to load a project that is selected in the tool window? If I just try to launch the csproj or sln file using Process.Start, it opens another instance of VS to load it.  I want to load it in my current instance.
    Wednesday, May 9, 2018 5:17 AM

All replies

  • Hi Terry Olsen,

    We could load project via DTE object. like this:

    EnvDTE.DTE dte = ...;
    dte.ExecuteCommand("File.OpenFile", strFilePath);

    Best regards,


    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.

    Wednesday, May 9, 2018 8:18 AM
  • You can use dte.Solution.Open method to open a .sln file in the current VS instance.

    Sergey Vlasov | Vlasov Studio | Visual Studio extensions and tools

    Wednesday, May 9, 2018 4:11 PM