Gokul's Blog


Leave a comment

Get Exe’s Folder in C#

Get Exe’s Folder in C#
[ sourcecode language=”csharp”]
var exePath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
if (exePath != null)
{
var logFolder = exePath.Replace(@”file:\”, “”) + @”\logs\”;
Console.WriteLine(logFolder);
}
[ /sourcecode]