简体   繁体   中英

how to get the application physical path in windows forms application

how to get the application path in windows forms , i used the bellow code but it is saying like "method not found"

Application.ExecutablePath;
Application.StartupPath;

please suggest me am i missing any namespace ?

thanks in advance

这将返回应用程序的完整路径

System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)

你也可以这样做

          System.AppDomain.CurrentDomain.BaseDirectory

添加引用System.Windows.Forms并使用section添加

using System.Windows.Forms;

Generally, Application.StartupPath() will give the path of the application. And also ru missing this namespace. System.Windows.Forms

System.Windows.Forms.Application.StartupPath必须返回正在运行的可执行文件的路径。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM