How to get the physical path of an application in a Windows forms application

How to get the path to the application in Windows forms, I used the following code, but it says "method not found"

Application.ExecutablePath; Application.StartupPath; 

please suggest me if i skip any namespace?

early

+6
source share
5 answers

This will return the full path to your application.

 System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) 
+11
source

You can do it the same

  System.AppDomain.CurrentDomain.BaseDirectory 
+5
source

Add the System.Windows.Forms link and add to the section

 using System.Windows.Forms; 
+1
source

Typically, Application.StartupPath() will indicate the path of the application. Also skip this namespace. System.Windows.Forms

0
source

System.Windows.Forms.Application.StartupPath should return the path to the executable executable.

0
source

Source: https://habr.com/ru/post/886691/


All Articles