I have created a managed dll and I would like to get the executable name it is attached to.... I have read this: How to get the executable path from a Managed DLL
It works fine with .net executables.... but when the dll runs under a com process, I don't have a .Net assembly... so Assembly.GetEntryAssembly() will return nothing....
Any ideas?
How about:
using System.Diagnostics;
...
Process process = Process.GetCurrentProcess();
string name = process.ProcessName;
ProcessModule module = process.MainModule;
string path = module == null ? null : module.FileName;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With