Avatar ·

How to get the path to the executable file of a console application in .NET?

Hello! I'm a beginner in C# and .NET, and I have a problem. I'm writing a console application that should read a configuration file located in the same folder as the program itself. But I can't figure out how to correctly get the path to the folder where my .exe file is located. Here's my code: ```csharp using System; using System.IO; class Program { static void Main(string[] args) { // Trying to get the path to the configuration file string configPath = "config.json"; if (File.Exists(configPath)) { Console.WriteLine("File found: " + configPath); } else { Console.WriteLine("File not found. Current directory: " + Directory.GetCurrentDirectory()); } Console.ReadKey(); } } ``` The problem