Tag: compact framework文件

如何获取应用程序的路径(没有app.exe)?

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