Visual studio addin - finding current solution folder path
-
10-07-2019 - |
Question
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?
Solution
Alas I figured it out after a lot of goooogling!!
In connect.cs:
public String SolutionPath()
{
return Path.GetDirectoryName(_applicationObject.Solution.FullName);
}
OTHER TIPS
The Solution.FullName answer is correct, but take care, you cannot access it until the OnStartupCompleted method is called in connect.cs.
you can use this code:
string solutionpath = Directory.GetParent(Application.ExecutablePath).Parent.Parent.Parent.FullName;
regards
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow