How to determine current EXE directory for a C# console application

$3
=
$0
+
$3
$3 Bitcoin bounty has been announced by author.
$0 has been already awarded by author.
$3 remains available.
1

I tried to determine current running directory of my C# console application using the following code:

Assembly.GetExecutingAssembly().Location

However that code returns path to assembly location. It may be different from the folder where EXE file is located.

My console application parses logs with no parameters. I want to know the path to the logs/ folder inside of the current executable's folder. Please help!

Tags: , ,

2 answers - total earned - 2 mBTC ($0.5 USD)

2
=
1
=
$0.5
1 tip with total amount of 2 mBTC($0.5 USD) have been sent by alexander.kojemyakin

In the ASP.NET. Have you ever wanted to get the directory for the executing Console Application in C#? The following method will do so, and is the equivalent of Application.StartupPath when working with Windows Forms.

System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)
SEND BITCOIN TIPS

Thanks, here is my tip!

Here is another tip

0

You can use following method:

System.Reflection.Assembly.GetExecutingAssembly().Location
SEND BITCOIN TIPS

Thank you

0

Post Answer


Will Bitcoin Tipping become a new Internet Culture?


Please share our story! THANK YOU!