Instead, you can try using the System.Reflection.Assembly class, for example
String strPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);
There are several other methods and properties in this class, so I'm sure you will find what you need.
source
share