我希望获得我应用程序的路径,例如: "\\ProgramFiles\\myApp"。我尝试使用以下代码:
string path = System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase;
但它返回的路径末尾带有“\\myapp.exe”。
我还尝试过:
string path = System.IO.Directory.GetCurrentDirectory();
但是它会抛出一个“NotSupportedException”异常。
有没有办法获得没有“.exe”结尾的路径?