Mega Code Archive

 
Categories / VB.Net / Reflection
 

Programmatically make a new app domain

Imports System.Reflection Module Program   Sub Main()     Dim anotherAD As AppDomain = AppDomain.CreateDomain("SecondAppDomain")     ' Load CarLibrary.dll into this new appdomain.     anotherAD.Load("CarLibrary")     PrintAllAssembliesInAppDomain(anotherAD)   End Sub   Public Sub PrintAllAssembliesInAppDomain(ByVal ad As AppDomain)     Dim loadedAssemblies As Assembly() = ad.GetAssemblies()     Console.WriteLine(ad.FriendlyName)     For Each a As Assembly In loadedAssemblies       Console.WriteLine("-> Name: {0}", a.GetName.Name)       Console.WriteLine("-> Version: {0}", a.GetName.Version)     Next   End Sub End Module