Search code examples
c#visual-studiovisual-studio-2015vsix

Acessing currently opened solution in a vsix project


I want to access the path to currently open solution in Visual Studio from a vsix project. How can I get that?

This thread tells if a solution is open or not but gives nothing about the path of the opened solution


Solution

  • I use this:

        public string GetInitialFolder(DTE dte)
        {
            if (!dte.Solution.IsOpen)
                return null;
            return System.IO.Path.GetDirectoryName(dte.Solution.FullName);
        }
    

    But expect it to error, sometimes it cannot return a path!