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
You can open any solution, project, folder or file in Visual Studio Code by simply right-clicking it in Solution Explorer and select Open in Visual Studio Code.
Installation location During installation, Extensions and Updates looks for the contents of the VSIX package in a folder under %LocalAppData%\Microsoft\VisualStudio\14.0\Extensions. By default, the installation applies only to the current user, because %LocalAppData% is a user-specific directory.
Expand Environment, and then choose Startup. In the On startup, open list, choose what you want to happen after Visual Studio launches. You can choose from Start window (which lets you open a new or existing project), Most recent solution, or Empty environment.
Click the UModel project in Solution Explorer of Visual Studio. 2. On the Project menu, click Unload project.
I would suggest to avoid EnvDTE as much as possible when developing packages and use native services whenever possible. In this case IVsSolution.GetSolutionInfo
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With