现在的位置: 首页 > 综合 > 正文

在Windows Mobile和Wince(Windows Embedded CE)下使用.NET Compact Framework 取当前运行文件的路径

2011年08月31日 ⁄ 综合 ⁄ 共 437字 ⁄ 字号 评论关闭

问题

.NET Compact Framework 提供了Directory.GetCurrentDirectory Method 取当前运行文件的目录,可是运行的时候会抛出 NotSupportedException

这个问题MSND的解释如下:

The operating system is Windows CE, which does not have current directory functionality.

This method is available in the .NET Compact Framework, but is not currently supported.

 

替代方案

使用 Path.GetDirectoryName MethodAssemblyName.CodeBase Property 来代替。

System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);

【上篇】
【下篇】

抱歉!评论已关闭.