Get all the referred assemblies list in PCL without using AppDomain?

ArunaldArunald Member

I am trying to get the referred assemblies in my portable project. I only found the way to using the AppDomain but the AppDomain is not working in PCL.

I can get this by below code in portable xamarin. But this is not working in UWP.

var currentdomain = typeof(string).GetTypeInfo().Assembly.GetType("System.AppDomain").GetRuntimeProperty("CurrentDomain").GetMethod.Invoke(null, new object[] { });
var getassemblies = currentdomain.GetType().GetRuntimeMethod("GetAssemblies", new Type[] { });
var assemblies = getassemblies.Invoke(currentdomain, new object[] { }) as Assembly[];

I want to use this in Xamarin, UWP platform. I can use the above code for Xamarin But I am helpless about UWP. How could I get the referred assemblies without using the AppDomain? Is there any alternative way?


  • ArunaldArunald Member
    edited May 2018

    I tried to get the assemblies details by the following method

                Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
                Assembly[] assembly = ((dynamic)Thread.GetDomain()).GetAssemblies() as Assembly[];

    But I get the exception respectively.

    The name 'AppDomain' does not exist in the current context

    The name 'Thread' does not exist in the current context

Sign In or Register to comment.