Search code examples
uwp.net-native

Compile with .NET Native Tool Chain fails in Server 2016 but succeeds in Windows 10


We have created a UWP project which compiles fine .Net Native Tool chain option in Windows 10 machine.

However, it fails in Windows Server 2016 Standard, which is build server.

Have tried changing the target versions but did not help.

Here're the errors and warnings:-

  • C:\Program Files (x86)\MSBuild\Microsoft.NetNative\x86\ilc\IlcInternals.targets(936,5): warning : ILTransform_0005: Type 'Windows.ApplicationModel.Activation.BackgroundActivatedEventArgs' was not included in compilation, but was referenced in method 'App.OnBackgroundActivated(BackgroundActivatedEventArgs)'. There may have been a missing assembly.
  • C:\Program Files (x86)\MSBuild\Microsoft.NetNative\x86\ilc\IlcInternals.targets(936,5): warning : ILTransform_0003: Method 'App.d__14.MoveNext()' will always throw an exception due to the missing method 'BackgroundActivatedEventArgs.get_TaskInstance()'. There may have been a missing assembly.
  • C:\Program Files (x86)\MSBuild\Microsoft.NetNative\x86\ilc\IlcInternals.targets(936,5): error : ILT0021: Could not resolve method 'System.Void Windows.UI.Xaml.Application.OnBackgroundActivated($ILT$FakeType0_Windows_ApplicationModel_Activation_BackgroundActivatedEventArgs)'
  • C:\Program Files (x86)\MSBuild\Microsoft.NetNative\x86\ilc\IlcInternals.targets(936,5): error : Type 'Windows.ApplicationModel.Activation.BackgroundActivatedEventArgs' was not included in compilation, but was referenced in method 'App.OnBackgroundActivated(BackgroundActivatedEventArgs)'. There may have been a missing assembly.
  • C:\Program Files (x86)\MSBuild\Microsoft.NetNative\x86\ilc\IlcInternals.targets(936,5): error : Method 'App.d__14.MoveNext()' will always throw an exception due to the missing method 'BackgroundActivatedEventArgs.get_TaskInstance()'. There may have been a missing assembly.

Solution

  • Please install the archived SDKs that match the app's target and min version, it will compile to native target fine. For sdk archive please refer this link