Saturday, February 16, 2008

C# .NET: Get current dirctory of the executing process

System.Environment.CurrentDirectory doesn't always give you the current directory of the process. For windows service, it gives you C:\windows\system32.

Use:
System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

No comments: