<Library> Element (.NET Native)
Defines the assembly that contains types and type members whose metadata is available for reflection at run time.
<Library Name="assembly_name" />
Attributes and Elements
The following sections describe attributes, child elements, and parent elements.
||Required attribute. Specifies the name of an assembly. Child elements of this
|assembly_name||The simple name of the assembly, without its file extension. This attribute corresponds to the AssemblyName.Name property. For example, the name of an assembly named Extensions.dll is "Extensions". See the Remarks section for a special form of assembly_name that supports conditional inclusion of metadata from the assembly.|
|<Assembly>||Applies policy to all the types in a particular assembly.|
|<Namespace>||Applies policy to all the types in a particular namespace.|
|<Type>||Applies policy to a particular type, such as a class or structure.|
|<TypeInstantiation>||Applies policy to a constructed generic type. For example, a <TypeInstantiation> element could be used to define policy for a
|<Directives>||The root element of a runtime directives file.|
The <Directives> element can contain zero, one, or more
<Library> element serves as a container to define the program elements whose metadata is needed at run time; this element doesn't express policy. At compile time, compiler tools search only the library designated by the
<Library> element for program elements identified by its child elements. In contrast, compiler tools search all libraries, including.NET Framework core libraries, for program elements identified by child elements of the <Application> element.
<Library> directives may be conditionally utilized. If the name of the
<Library> element starts and ends with an asterisk (*), the
<Library> directive has an effect only if the assembly specified between the asterisks is referenced by the app. For example, the following runtime directive applies only if the Utilities.dll assembly is referenced by the app.
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata"> <Library Name="*Utilities*"> ... </Library> </Directives>