如何获得Windows窗体应用程序的路径,我用的波纹管代码,但它是说像“未找到方法”如何获得在Windows应用程序的物理路径表单应用程序
Application.ExecutablePath;
Application.StartupPath;
请建议我是我缺少任何命名空间?
在此先感谢
如何获得Windows窗体应用程序的路径,我用的波纹管代码,但它是说像“未找到方法”如何获得在Windows应用程序的物理路径表单应用程序
Application.ExecutablePath;
Application.StartupPath;
请建议我是我缺少任何命名空间?
在此先感谢
这将完整的路径返回到应用程序
System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)
添加引用System.Windows.Forms
,并添加使用部分
using System.Windows.Forms;
一般来说,Application.StartupPath()
会给路径应用程序。而且你也缺少这个名字空间。 System.Windows.Forms
System.Windows.Forms.Application.StartupPath
必须返回正在运行的可执行文件的路径。
你能做到这样也
System.AppDomain.CurrentDomain.BaseDirectory