In order to obtain a running EXE's file location, you may use the method: System.AppDomain.CurrentDomain.BaseDirectory to get it. However, this method doesn't work similarly for a running DLL. This is because it would return the file location of the "container" that calls the DLL, but not the DLL itself.
So the proper way to obtain a running DLL's file location is to use the method: System.Reflection.Assembly.GetExecutingAssembly.Location
Many credits to this site.
No comments:
Post a Comment