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
A program's App Paths key typically contains a value named Path, which should contain a semicolon-delimited list of directories where the program's . dll files could be located. Windows uses this key to find your application and its . dll files if their locations are not already in the system's path.
Right click on Project menu and click on "Project name Properties". Click the sign in option and select the checkbox (Sign the Click Once manifests). Go to Security >> select Check Box (Enable Click Once Security Settings). Go to Publish >> select Publishing folder location path and Save.
This will return the complete path to your Application
System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)
You can do it like this as well
System.AppDomain.CurrentDomain.BaseDirectory
System.Windows.Forms.Application.StartupPath
must return the path of the running executable.
Add reference System.Windows.Forms
and add in using section
using System.Windows.Forms;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With