Getting assembly name
I use the Assembly to set the form's title as such:
private String BuildFormTitle()
{
String AppName = System.Reflection.Assembly.GetEntryAssembly().GetName().Name;
String FormTitle = String.Format("{0} {1} ({2})",
AppName,
Application.ProductName,
Application.ProductVersion);
return FormTitle;
}
System.Reflection.Assembly.GetExecutingAssembly().GetName().Name
or
typeof(Program).Assembly.GetName().Name;
You could try this code which uses the System.Reflection.AssemblyTitleAttribute.Title
property:
((AssemblyTitleAttribute)Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute), false)).Title;
You can use the AssemblyName
class to get the assembly name, provided you have the full name for the assembly:
AssemblyName.GetAssemblyName(Assembly.GetExecutingAssembly().Location).Name
or
AssemblyName.GetAssemblyName(e.Source).Name
MSDN Reference - AssemblyName Class