9

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

5 Answers 5

15

This will return the complete path to your Application

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

You can do it like this as well

          System.AppDomain.CurrentDomain.BaseDirectory
2

System.Windows.Forms.Application.StartupPath must return the path of the running executable.

1

Add reference System.Windows.Forms and add in using section

using System.Windows.Forms;
0

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.