[英]C# Uri AppDomain.CurrentDomain.BaseDirectory relative path
How do you get the relative path to AppDomain.CurrentDomain.BaseDirectory into a Uri. 如何获取AppDomain.CurrentDomain.BaseDirectory到Uri的相对路径。
I need to step up "cd ......" from the AppDomain.CurrentDomain.BaseDirectory and then down to other folders. 我需要从AppDomain.CurrentDomain.BaseDirectory升级“cd ......”,然后再向下升级到其他文件夹。
Do you know how? 你知不知道怎么?
Thanks in advance 提前致谢
Regards 问候
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\\");
I ended up using the following: 我最终使用了以下内容:
System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"......\\www\\"); System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory,@“...... \\ www \\”);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.