Recognition of the currently open solution in the vsix project

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

+5
source share
2 answers

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!

+1
source

I suggest avoiding EnvDTE as much as possible when developing packages and using native services whenever possible. In this case, IVsSolution.GetSolutionInfo

+3
source

All Articles