You can initialise a StreamResourceInfo
object with a downloaded zip stream (Xap or otherwise).
You can then use Application.GetResourceStream
to pull a stream for file from that zip using a Uri
. In this case the dll which can then load with AssemblyPart
and then call a CreateInstance
on it:-
WebClient client = new WebClient()
client.OpenReadCompleted += (s, args) =>
{
StreamResourceInfo zip = new StreamResourceInfo(args.Result, "application/zip");
StreamResourceInfo dll = Application.GetResourceStream(zip, new Uri("b.dll", UriKind.Relative));
AssemblyPart assemblyPart = new AssemblyPart();
Assembly assembly = assemblyPart.Load(dll.Stream);
_someClassFromB = assembly.CreateInstance("b.SomeClass");
};
client.OpenReadAsync(new Uri("your.xap", UriKind.Relative));