.net 获取当前DLL所在目录

string dllPath = Path.GetDirectoryName(new Uri(this.GetType().Assembly.CodeBase).AbsolutePath;


静态函数中则不可用:

string dllPath = Path.GetDirectoryName(new Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).LocalPath);

你可能感兴趣的:(.net 获取当前DLL所在目录)