How do I find the application's path in a console application?
In Windows Forms, I can use Application.StartupPath
to find the current path, but this doesn't seem to be available in a console application.
How do I find the application's path in a console application?
In Windows Forms, I can use Application.StartupPath
to find the current path, but this doesn't seem to be available in a console application.
For Console Applications, you can try this:
Output (on my local machine):
Or you can try (there's an additional backslash in the end):
Output:
I have used
when I want to find a path relative to an applications folder. This works for both ASP.Net and winform applications. It also does not require any reference to System.Web assemblies.