c# 获取项目的根路径
//获取.exe文件路径
string currentPath = Application.StartupPath;
//获取该文件的上级路径
Directory.SetCurrentDirectory(Directory.GetParent(Directory.GetCurrentDirectory()).FullName);
string parentPath=Directory.GetCurrentDirectory();
//如果需要继续上级路径,继续执行,就可以得到两次的上级路径
Directory.SetCurrentDirectory(Directory.GetParent(Directory.GetCurrentDirectory()).FullName);
————————————————
原文链接:https://blog.csdn.net/Simon1003/article/details/85101492