I found something on google but it not working on C# Console Application
What I found:
string appPath = Path.GetDirectoryName(Application.ExecutablePath);
How I can get application directory using c# Console Application?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you still want to use Application.ExecutablePath in console application you need to:
Add System.Windows.Forms to your usings section
Also you can use
Directory.GetCurrentDirectory()instead ofPath.GetDirectoryName(Application.ExecutablePath)and thus you won’t need a reference to System.Windows.Forms.If you’d like not to include neither
System.IOnorSystem.Windows.Formsnamespaces then you should follow Reimeus’s answer.