If you know the assembly's file system path, you can call the static (C#) or Shared (Visual Basic) AssemblyName. GetAssemblyName method to get the fully qualified assembly name.
An assembly's name is stored in metadata and has a significant impact on the assembly's scope and use by an application. A strong-named assembly has a fully qualified name that includes the assembly's name, culture, public key, version number, and, optionally, processor architecture.
Open Visual Studio Go to Tools –> External Tools –> Add Title: Get Qualified Assembly Name Command: Powershell.exe Arguments: -command "[System. Reflection. AssemblyName]::GetAssemblyName(\"$(TargetPath)\"). FullName" Check "Use Output Window".
The assembly-qualified name of a type consists of the type name, including its namespace, followed by a comma, followed by the display name of the assembly. The display name of an assembly is obtained using the Assembly. FullName property.
System.Reflection.Assembly.GetExecutingAssembly().GetName().Name
or
typeof(Program).Assembly.GetName().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;
}
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
Assembly.GetExecutingAssembly().Location
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With