Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

How can I get the application's path in a .NET console application?

How would I discover the application's way in a console application?

In Windows Forms, I can utilize the Application.StartupPath to track down the current way, however, this doesn't appear to be accessible in a console application.
by

2 Answers

akshay1995
You can use the following code to get the current application directory.

AppDomain.CurrentDomain.BaseDirectory
kshitijrana14
You may be looking to do this:
System.IO.Path.GetDirectoryName(
System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)

Login / Signup to Answer the Question.