Link to home
Start Free TrialLog in
Avatar of ICSAutomation
ICSAutomationFlag for Switzerland

asked on

Get directory path

Hello
With
string paht = System.IO.Directory.GetCurrent Directory();
I get the Path: "D:\MyProjects\TestProject\UI\binDebug"

How can I get the Path "D:\MyProjects\TestProject" ? (is two levels higher)
Avatar of Dirk Haest
Dirk Haest
Flag of Belgium image

If I may ask: why do you need that path, because the first path has the name of the path where the exe resides.
When you deploy the application, it will contain the correct path.
ASKER CERTIFIED SOLUTION
Avatar of Dirk Haest
Dirk Haest
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Use as it one line code...

first add
using System.IO;
string path = System.IO.Directory.GetParent(Directory.GetParent(Directory.GetCurrentDirectory().ToString()).ToString()).ToString();