Visual studio addin - finding current solution folder path

烂漫一生 提交于 2019-12-30 08:23:13

问题


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?


回答1:


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

In connect.cs:

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



回答2:


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




回答3:


you can use this code:

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

regards



来源:https://stackoverflow.com/questions/633985/visual-studio-addin-finding-current-solution-folder-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!