I want to access the path to the currently open solution in Visual Studio from a vsix project. How can i get this?
This thread reports whether the solution is open or not, but gives nothing about the path of an open 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 his mistakes, sometimes he cannot get the way back!
I suggest avoiding EnvDTE as much as possible when developing packages and using native services whenever possible. In this case, IVsSolution.GetSolutionInfo