Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual studio addin - finding current solution folder path

I have an add-in loaded, and a solution loaded, how would I find the folder path of that solution programmatically in C# in my addin?

like image 345
Tom J Nowell Avatar asked Mar 11 '09 10:03

Tom J Nowell


People also ask

How do I find the path to a folder in Visual Studio?

Did you know you can right click on the tab in the code editor window to access the file path or to open the folder in Windows Explorer? Check it out. By default, the file path for Visual Studio projects is very long.

What is new solution folder in Visual Studio?

What are Visual Studio Solution Folders? In Visual Studio, you can add virtual folders to group and organize your projects and files. Folders can be nested, collapsed, expanded, and even hidden in the Solution Explorer. Please keep in mind that these folders are entirely virtual.


2 Answers

Alas I figured it out after a lot of goooogling!!

In connect.cs:

    public String SolutionPath()
    {
        return Path.GetDirectoryName(_applicationObject.Solution.FullName);
    }
like image 75
Tom J Nowell Avatar answered Oct 19 '22 22:10

Tom J Nowell


The Solution.FullName answer is correct, but take care, you cannot access it until the OnStartupCompleted method is called in connect.cs.

like image 36
Jesper Niedermann Avatar answered Oct 19 '22 22:10

Jesper Niedermann