Export (0) Print
Expand All

AssemblyName Constructor (String)

Initializes a new instance of the AssemblyName class with the specified display name.

Namespace:  System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

public:
AssemblyName(
	String^ assemblyName
)

Parameters

assemblyName
Type: System::String

The display name of the assembly, as returned by the FullName property.

ExceptionCondition
ArgumentNullException

assemblyName is nullptr.

ArgumentException

assemblyName is a zero length string.

FileLoadException
NoteNote

In the .NET for Windows Store apps or the Portable Class Library, catch the base class exception, IOException, instead.

The referenced assembly could not be found, or could not be loaded.

The supplied assemblyName is parsed, and the appropriate fields of the new AssemblyName are initialized with values from the display name. This is the recommended way of parsing display names. Writing your own code to parse display names is not recommended.

The following example creates an instance of AssemblyName from a display name. The individual elements of the display name are output to the console as properties of the AssemblyName object.

using namespace System;
using namespace System::Reflection;

int main()
{
   // Create an AssemblyName, specifying the display name, and then 
   // print the properties.
   AssemblyName^ myAssemblyName = 
      gcnew AssemblyName("Example, Version=1.0.0.2001, Culture=en-US, PublicKeyToken=null");
   Console::WriteLine("Name: {0}", myAssemblyName->Name);
   Console::WriteLine("Version: {0}", myAssemblyName->Version);
   Console::WriteLine("CultureInfo: {0}", myAssemblyName->CultureInfo);
   Console::WriteLine("FullName: {0}", myAssemblyName->FullName);
}
/* This code example produces output similar to the following:

Name: Example
Version: 1.0.0.2001
CultureInfo: en-US
FullName: Example, Version=1.0.0.2001, Culture=en-US, PublicKeyToken=null
 */

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone 8, Silverlight 8.1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft