C# – How to find the current executable filename?

.netc++

Possible Duplicate:
How do I get the name of the current executable in C#?

An executable file loads an external library.
Is there a way for the library to know the calling executable file?

(I would have sworn I saw the answer to this elsewhere, but I can't seem to find it anymore)

Best Solution

System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName