AssemblyName.FullName Property
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Gets the full name of the assembly, also known as the display name.
Assembly: mscorlib (in mscorlib.dll)
The display name typically consists of the simple name, version number, supported culture, and public key token. For example:
mylib, Version=1.2.1900.0, Culture=neutral, PublicKeyToken=a14f3033def15840
We do not recommend writing your own code to parse display names. Instead, pass the display name to the AssemblyName(String) constructor, which parses it and populates the appropriate fields of the new AssemblyName.
When an assembly is loaded, this value can also be obtained by using the Assembly.FullName property.
Version Notes
Windows Phone
Instead of an empty string, this member returns System.Reflection.AssemblyName if the AssemblyName object was instantiated with the default constructor. Windows Phone does not return PublicKeyToken information by default. You must use individual methods to compare the culture, version, and PKT information.The following example gets the full name of a .NET Framework assembly, parses it by using the AssemblyName(String) constructor, and uses the properties and methods of AssemblyName to display the individual parts. Finally, the FullName property is displayed.
Note: |
|---|
To run this example, see Building examples that have static TextBlock controls for Windows Phone 8. |
using System; using System.Reflection; public class Example { private const byte mask = 15; private const string hex = "0123456789ABCDEF"; public static void Demo(System.Windows.Controls.TextBlock outputBlock) { // Use AssemblyName to parse full assembly names. In this example, the // assembly is mscorlib.dll. string name = typeof(string).Assembly.FullName; AssemblyName asmName = new AssemblyName(name); outputBlock.Text += String.Format("Name: {0}\n", asmName.Name); outputBlock.Text += String.Format("Version: {0}\n", asmName.Version); outputBlock.Text += String.Format("CultureInfo: {0}\n", asmName.CultureInfo); System.Text.StringBuilder pkt = new System.Text.StringBuilder(); foreach( byte b in asmName.GetPublicKeyToken() ) { pkt.Append(hex[b / 16 & mask]); pkt.Append(hex[b & mask]); } outputBlock.Text += String.Format("PublicKeyToken: {0}\n", pkt.ToString()); outputBlock.Text += String.Format("FullName: {0}\n", asmName.FullName); } } /* This example produces output similar to the following: Name: mscorlib Version: 2.0.5.0 CultureInfo: PublicKeyToken: 7CEC85D7BEA7798E FullName: mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e */
Note: