In case you haven't heard of merged assemblies before, they are basically a way of creating a single file out of multiple assemblies. Microsoft have developed a tool to allow you to do this called ILMerge. You can download it from here.

Everything is working fine for me as long as I load the merged assembly within the current domain. Let's assume I have a merged assembly composed of the assemblies A (primary assembly) and B.

      public Type[] GetTypesFromAssembly(byte[] assembly)

      {

            return Assembly.Load(assembly).GetTypes();

      }

 

The above piece of code will load the assembly into the current AppDomain, and return you the types that reside both in the assemblies A and B.

      public Type[] GetTypesFromAssembly(byte[] assembly)

      {

            AppDomain appDomain = AppDomain.CreateDomain("TestAppDomain");

            return appDomain.Load(assembly).GetTypes();

      }

 

The above piece of code will first create a new AppDomain and then load the assembly into it. The types returned this time will be only the types in assembly A (i.e. the primary one) and not B.

Can anyone think of why this would be the case?

[Update 16.03.07] Turns out what I am trying to do here is just silly. :)