Reputation: 25994
How do you get the relative path to AppDomain.CurrentDomain.BaseDirectory into a Uri.
I need to step up "cd ......" from the AppDomain.CurrentDomain.BaseDirectory and then down to other folders.
Do you know how?
Thanks in advance
Regards
Upvotes: 3
Views: 5571
Reputation: 25994
I ended up using the following:
System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"......\www\");
Upvotes: 1
Reputation: 1634
If you just want to step up one ore more folders and then down, you could use something like this.
To get a file two folders up:
AppDomain.CurrentDomain.BaseDirectory+"..\\..\\Program.cs"
To get a file two folders up and one down:
AppDomain.CurrentDomain.BaseDirectory + "..\\..\\Properties\\AssemblyInfo.cs"
If you just want the path you could do something like this:
Path.GetFullPath(AppDomain.CurrentDomain.BaseDirectory + "..\\..\\Properties\\");
Upvotes: 8