locked
Getting current project directory RRS feed

  • Question

  • Hello,

    I found out that in order to get the running projects directory i need to use this code:

    EnvDTE.DTE dte = (EnvDTE.DTE)GetService(typeof(EnvDTE.DTE));
    solutionDir = System.IO.Path.GetDirectoryName(dte.Solution.FullName);

    but i don't know where to put it, i saw some have put it in the onConnection method, but i'm developing a vs package so what is the onConnection equivalent? 

    Sunday, December 29, 2013 1:53 PM

Answers

  • A solution is probably not yet loaded when you call dte.Solution.FullName.


    If you want to do something automatically on each solution load, you need to subscribe to SolutionEvents.

    If you need the solution directory on a user action (e.g. a menu command), put your code in the command handler.


    Sergey Vlasov | Vlasov Studio | Visual Studio add-ins, extensions and tools

    Monday, December 30, 2013 4:40 AM

All replies