如何获取智能设备应用程序中应用程序的路径?

发布于 2024-08-23 17:15:52 字数 184 浏览 12 评论 0原文

我正在用 C# 开发智能设备应用程序。我想要我的应用程序的确切路径。我的应用程序驻留在我的计算机上,位置为 F:/MobileAppl/ManagedAppl。

所以我想在智能设备应用程序中使用这条路径。

请确保.net框架的所有功能在.net紧凑框架中不起作用。

您能给我提供解决上述问题的代码或链接吗?

I am develpoing smart device application in C#. I want the exact path of my application. My application resides on my machine at F:/MobileAppl/ManagedAppl.

So I want this path in smart device application.

Please make sure that all the functions of .net framework does not work in .net compact framework.

Can you provide me the code or link through which i can resolve the above issue?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

旧情勿念 2024-08-30 17:15:52

这应该适用于 Windows 应用程序和移动应用程序

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

链接文本

This should work well for both windows application and mobile application

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

link text

浮世清欢 2024-08-30 17:15:52
public static string getPath() 
{
    string fullname;
    string myAppPath;
    fullname = System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase;
    myAppPath = System.IO.Path.GetDirectoryName(fullname);
    myAppPath = myAppPath.Replace("file:\\", "");
    return myAppPath;
}
public static string getPath() 
{
    string fullname;
    string myAppPath;
    fullname = System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase;
    myAppPath = System.IO.Path.GetDirectoryName(fullname);
    myAppPath = myAppPath.Replace("file:\\", "");
    return myAppPath;
}
和我恋爱吧 2024-08-30 17:15:52
 string path = System.IO.Path.GetDirectoryName( 
 System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase );

此代码不会返回正确的路径。

我的应用程序路径是D:/Test/MobilApplication。

在执行上面的代码时,它仅显示“//Program files//MobilApplication”,如下所示。

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

this code will not return correct path .

My Application path is D:/Test/MobilApplication.

While executing above code it shows simply "//Program files//MobilApplication" like that.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文