Path of the executing assembly:
public static string GetExecutingAssemblyPath() { string codeBase = Assembly.GetExecutingAssembly().CodeBase; UriBuilder uri = new UriBuilder(codeBase); string path = Uri.UnescapeDataString(uri.Path); return Path.GetDirectoryName(path); }
Get title of executing assembly:
/// <summary> /// Gets the assembly title. /// </summary> public static string GetAssemblyTitle() { object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); if (attributes.Length > 0) { var titleAttribute = (AssemblyTitleAttribute)attributes[0]; if (!string.IsNullOrWhiteSpace(titleAttribute.Title) return titleAttribute.Title; } return Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase); }