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?
Asked
Active
Viewed 5,823 times
9
-
2programmatically, this is a real question. – Tom J Nowell Mar 11 '09 at 10:38
-
Then you need to rephrase your question better, only after reading through it 4 more times, I understood what you are looking for. – leppie Mar 11 '09 at 10:40
-
1@leppie: in what way is this not real and relevant. I no longer know the answer, or I'd answer it. Some property of the Solution object, I think. – John Saunders Mar 11 '09 at 10:41
3 Answers
12
Alas I figured it out after a lot of goooogling!!
In connect.cs:
public String SolutionPath()
{
return Path.GetDirectoryName(_applicationObject.Solution.FullName);
}

Tom J Nowell
- 9,588
- 17
- 63
- 91
3
The Solution.FullName answer is correct, but take care, you cannot access it until the OnStartupCompleted method is called in connect.cs.

Jesper Niedermann
- 765
- 7
- 17
1
you can use this code:
string solutionpath = Directory.GetParent(Application.ExecutablePath).Parent.Parent.Parent.FullName;
regards

Luis Rodriguez
- 41
- 2