Xbasic

DotNet::AssemblyReference Class

Description

Defines an assembly by either referencing a file or through elements that make up the canonical name.

Discussion

AssemblyReference is a data-only class that defines an assembly by either referencing a file or through elements that make up the canonical name. The purpose of this class is to simplify calling functions on the DotNet::Services object.

Canonical names are used to reference assemblies that are registered in the .NET Global Assembly Cache (GAC). The use of this cache allows for sharing of assemblies (much like installing a DLL into System32 or registering an OLE type with multiple versions). The objective is to be sure that multiple versions of an assembly can coexist in a managed way.

Referencing an assembly by file name (typically a "private assembly") is used for assemblies that are NOT registered in the global cache and are stored in a directory the application knows how to find.

This class is not intended to replace the .NET class System.Reflection.AssemblyName. Its sole purpose is to describe an assembly that is to be loaded in the functions below.

Example

  1. Create a reference to an assembly by file name.

    Dim Assy as DotNet::AssemblyReference
    
    Assy.FileName = MyAssembly.dll
  2. Create a reference to an assembly by name, version, culture and public key token.

    Dim Assy as DotNet::AssemblyReference
    
    Assy.Name = "SampleAssembly"
    Assy.Version = "1.0.2004.0"
    Assy.Culture = "neutral"
    Assy.PublicKeyToken = "8744b20f8da049e3"

When an instance of this class is passed to one of the functions in the DotNet::Services class, FileName takes precedence.

  • If FileName is populated, the assembly will be loaded from the path and file provided.

  • If FileName is empty, the called function will construct the canonical form of the name to use in loading the assembly; for example "SampleAssembly, Version=1.0.2004.0, Culture=neutral, PublicKeyToken=8744b20f8da049e3"

Properties

FileNameCharacter

-

NameCharacter

-

VersionCharacter

-

CultureCharacter

-

PublicKeyTokenCharacter

-

FullNameCharacter

Read Only

See Also