Skip to main content Skip to footer

.NET Native and UWP Edition

.NET Native is a precompilation technology for building and deploying UWP applications. It is available in Visual Studio 2015, and it's also a part of app store submission process.

Try ComponentOne Studio UWP Edition

.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" />  

MSDN resources:

Learn more about C1Studio UWP Edition

MESCIUS inc.

comments powered by Disqus