我想获取我的应用程序的路径,例如:“\\ProgramFiles\\myApp”,我尝试使用以下代码:
string path = System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase;
但它返回一个结尾有“\\myapp.exe”的路径。
我也试过:
string path = System.IO.Directory.GetCurrentDirectory();
但它会引发“NotSupportedException”。
有没有办法在最后获得没有 .exe 的路径?