Tom J Nowell
Tom J Nowell

Reputation: 9981

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?

Upvotes: 9

Views: 5887

Answers (3)

Luis Rodriguez
Luis Rodriguez

Reputation: 41

you can use this code:

string solutionpath = Directory.GetParent(Application.ExecutablePath).Parent.Parent.Parent.FullName;

regards

Upvotes: 1

Jesper Niedermann
Jesper Niedermann

Reputation: 775

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

Upvotes: 3

Tom J Nowell
Tom J Nowell

Reputation: 9981

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

In connect.cs:

    public String SolutionPath()
    {
        return Path.GetDirectoryName(_applicationObject.Solution.FullName);
    }

Upvotes: 12

Related Questions