Visual studio addin - finding current solution folder path

前端 未结 3 988
终归单人心
终归单人心 2021-01-12 02:24

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?

相关标签:
3条回答
  • 2021-01-12 02:54

    you can use this code:

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

    regards

    0 讨论(0)
  • 2021-01-12 02:55

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

    In connect.cs:

        public String SolutionPath()
        {
            return Path.GetDirectoryName(_applicationObject.Solution.FullName);
        }
    
    0 讨论(0)
  • 2021-01-12 02:59

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

    0 讨论(0)
提交回复
热议问题