如何获取应用程序路径 [英] How to get application path

查看:121
本文介绍了如何获取应用程序路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用

string path = AppDomain.CurrentDomain.BaseDirectory; 来获取我的应用程序路径,这会给出类似

string path = AppDomain.CurrentDomain.BaseDirectory; to get my application path ,but this gives something like

C:\Projects\XYZ\ABC\bin\Debug

我不想要bin \Debug。有没有办法实现这个?

i don't want bin\Debug .Is there any way to achieve this ?

推荐答案

AppDomain。 CurrentDomain.BaseDirectory 属性获取程序集解析器用于探测程序集的基本目录。

The AppDomain.CurrentDomain.BaseDirectory property gets the base directory that the assembly resolver uses to probe for assemblies.

所以它的功能应该是100%。如果您要构建您的应用程序,请将其剪切并粘贴到其他文件夹或驱动器中的其他位置。这些更改将反映在此属性中。

So it's functioning 100% as it should. If you were to build your application, cut and paste it somewhere else in another folder or drive. Those changes would be reflected in this property.

此外,您提到您不希望此部分 bin\Debug ,所以你想要什么之前呢?请具体说明。

Also, you mentioned that you do not want this part bin\Debug, so you want what's before that? Please be specific.

这篇关于如何获取应用程序路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆