I\'m a .NET user, and my goal is as simple as finding the absolute path of the directory of my main executing assembly (the EXE file).
I have several candidates:
Unfortunately, all the methods above can fail if you use a virtualization like XenoCode postbuild. I have tested many methods and found another solution here. I've found that only the
System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".exe"
returns the correct filename of the executable.
So combining the filename with the path from Assembly.GetEntryAssembly().Location you will get the correct path of the executable.