C# Tips and Tricks #6 – Find the Application Path in Console Application

Your 2020 Plan. Learn 20 minutes a day for 20 days. Online courses from €9.99.

There are times when you are working on a console application in C# and you might want to get the application path. You might notice that the Application.StartupPath would not be available in console application which exists in the Winforms.

How to get Application Path in a Console Application in C#?

You can use the reflection to get it easily using the property


Here’s a sample code demonstrating how to get the application path in console application in C#.

using System;
namespace ConsoleApp1
    class Program
        static void Main(string[] args)

            string path = System.Reflection.Assembly.GetExecutingAssembly().Location;

Leave a Reply

Your email address will not be published. Required fields are marked *