Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

In UWP project, how do we add assemblies in App.xaml.cs to compile with .net native toolchain?

$
0
0

Per the Troubleshooting section of https://developer.xamarin.com/guides/cross-platform/xamarin-forms/windows/getting-started/universal/, are we expected to track down every single .dll referenced by the PCL and UWP projects and add them one by one? If not, how do we discern assemblies that need to be added vs. those that do not?

For Example (If i'm missing an assembly referenced by my PCL the app will crash on launch?):

     // you'll need to add `using System.Reflection;`
            List<Assembly> assembliesToInclude = new List<Assembly>();

            assembliesToInclude.Add(typeof(Xamarin.Insights).GetTypeInfo().Assembly);
            assembliesToInclude.Add(typeof(ImageCircle.Forms.Plugin.Abstractions.CircleImage).GetTypeInfo().Assembly);
            assembliesToInclude.Add(typeof(ImageCircle.Forms.Plugin.UWP.ImageCircleRenderer).GetTypeInfo().Assembly);
            assembliesToInclude.Add(typeof(ModernHttpClient.CaptiveNetworkException).GetTypeInfo().Assembly);
            assembliesToInclude.Add(typeof(Plugin.Connectivity.Abstractions.BaseConnectivity).GetTypeInfo().Assembly);
            assembliesToInclude.Add(typeof(Plugin.Connectivity.ConnectivityImplementation).GetTypeInfo().Assembly);
            assembliesToInclude.Add(typeof(Plugin.Settings.Abstractions.ISettings).GetTypeInfo().Assembly);
            assembliesToInclude.Add(typeof(Plugin.Settings.CrossSettings).GetTypeInfo().Assembly);
            assembliesToInclude.Add(typeof(Newtonsoft.Json.ConstructorHandling).GetTypeInfo().Assembly);
            assembliesToInclude.Add(typeof(Refit.AliasAsAttribute).GetTypeInfo().Assembly);
            assembliesToInclude.Add(typeof(System.Net.Http.ByteArrayContent).GetTypeInfo().Assembly);
            assembliesToInclude.Add(typeof(System.Net.NetworkInformation.IPAddressCollection).GetTypeInfo().Assembly);
            assembliesToInclude.Add(typeof(Plugin.Media.CrossMedia).GetTypeInfo().Assembly);
            assembliesToInclude.Add(typeof(Plugin.Media.Abstractions.CameraDevice).GetTypeInfo().Assembly);
            assembliesToInclude.Add(typeof(System.Linq.Enumerable).GetTypeInfo().Assembly);

            //Also do this for all your other 3rd party libraries
            Xamarin.Forms.Forms.Init(e, assembliesToInclude);

So far I have not been able to successfully run my app when compiling with the .net native toolchain.


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>