Applies runtime reflection policy to all the types in a specified assembly.
<Assembly Name="assembly_name" Activate="policy_setting" Browse="policy_setting" Dynamic="policy_setting" Serialize="policy_setting" /> DataContractSerializer="policy_setting" DataContractJsonSerializer="policy_setting" XmlSerializer="policy_setting" MarshalObject="policy_setting" MarshalDelegate="policy_setting" MarshalStructure="policy_setting" />
Attributes and Elements
The following sections describe attributes, child elements, and parent elements.
||General||Required attribute. Specifies the simple name of an assembly.|
||Reflection||Optional attribute. Controls runtime access to constructors to enable activation of instances.|
||Reflection||Optional attribute. Controls querying for information about or enumerating the types in the assembly, but does not enable any dynamic access at run time.|
||Reflection||Optional attribute. Controls runtime access to all type members, including constructors, methods, fields, properties, and events, to enable dynamic programming.|
||Serialization||Optional attribute. Controls runtime access to constructors, fields, and properties, to enable type instances to be serialized and deserialized by libraries such as the Newtonsoft JSON serializer.|
||Serialization||Optional attribute. Controls policy for serialization that uses the System.Runtime.Serialization.DataContractSerializer class.|
||Serialization||Optional attribute. Controls policy for JSON serialization that uses the System.Runtime.Serialization.Json.DataContractJsonSerializer class.|
||Serialization||Optional attribute. Controls policy for XML serialization that uses the System.Xml.Serialization.XmlSerializer class.|
||Interop||Optional attribute. Controls policy for marshaling reference types to Windows Runtime and COM.|
||Interop||Optional attribute. Controls policy for marshaling delegate types as function pointers to native code.|
||Interop||Optional attribute. Controls policy for marshaling structures to native code.|
|assembly_name||The simple name of the assembly, without its file extension. This attribute corresponds to the System.Reflection.AssemblyName.Name property. For example, the name of an assembly named Extensions.dll is "Extensions".
You can also specify the literal string
All other attributes
|policy_setting||The setting to apply to this policy type for all types in the assembly. Possible values are
|<Namespace>||Applies reflection policy to all types in a child namespace.|
|<Type>||Applies reflection policy to a type.|
|<TypeInstantiation>||Applies reflection policy to a constructed generic type.|
|<Application>||Serves as a container for application-wide types and type members whose metadata is available for reflection at run time. The <Application> element can have zero, one, or more
|<Library>||Defines the assembly that contains types and type members whose metadata is available for reflection at run time. The <Library> element can have zero or one
<Assembly> element defines runtime policy for all the types in an assembly. It differs from the <Library> element, which specifies a library but depends on its child elements to define runtime reflection policy. The
<Assembly> element applies to all the types in an assembly unless they are overridden by a child element.
The following example shows how you can apply runtime policy to all the types in assemblies within your app package by assigning the
Name attribute a value of "Application\". The
<Assembly> element must be a child of the <Application> element.
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata"> <Application> <Assembly Name="*Application*" Dynamic="Required All" /> </Application> </Directives>
Serialize attributes are all optional. However, the
<Assembly> element must contain at least one of these attributes.