.Net Native and runtime directives
.NET Native compiles an entire application to a native application. It links implementation code into your app only if it knows that your app actually invokes that code. If it's not obvious that your application requires some the metadata or the implementation code, native application might be built without it.
In this case, the .NET Native runtime will throw an exception. You can prevent these exceptions, and ensure that the .NET Native tool chain includes the required metadata and implementation code, by using a runtime directives file: an XML file that designates the program elements whose metadata or implementation code must be available at runtime and assigns a runtime policy to them.
The following is the default runtime directives file added to a Windows Store project that is compiled by the .NET Native tool chain:
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata"> <Application> <Assembly Name="*Application*" Dynamic="Required All" /> </Application> </Directives>
This is enough for most applications, but not all. For example, our CalendarData sample uses classes from the Windows.ApplicationModel.Appointments namespace as data source for the C1Calendar control. The C1Calendar control needs Windows.ApplicationModel.Appointments namespace metadata to work with related classes via reflection. To include these metadata into compiled native application we added the next line to Default.rd.xml file:
<Namespace Name="Windows.ApplicationModel.Appointments" Dynamic="Required Public" />
The only ComponentOne Studio control that needs the additional line in your application's Default.rd.xml file is FlexGrid. It uses reflection to handle arbitrary controls in cell editors.
Adding this line to your Default.rd.xml file should be enough for FlexGrid in most cases:
<Namespace Name="Windows.UI.Xaml.Controls" Serialize="PublicAndInternal" />
If you use data annotation attributes and want our controls to honor them, then you should also add this line:
<Namespace Name="System.ComponentModel.DataAnnotations" Dynamic="Required All" />
- Getting Started with .NET Native
- .NET Native and Compilation
- Runtime Directives (rd.xml) Configuration File Reference