private static string GetAssemblyDir(Assembly assembly) { // CodeBase is a full URI, such as file:///x:\blahblah. Uri uri = new Uri(assembly.CodeBase); return Path.GetDirectoryName(uri.LocalPath) + Path.DirectorySeparatorChar; }