I am currently developing an application in where a user will dynamically choose dlls and the application will execute some of the methods in that dll. (if you follow t
What you're looking to do is basically running Assemblies in a separate Application Domain. Check out this page on MSDN for a good starting point. It's actually quite east to do:
http://msdn.microsoft.com/en-us/library/ms173139(VS.80).aspx
Normally, you might just live with
AppDomain newDomain = AppDomain.CreateDomain(name);
Assembly asm = newDomain.Load(System.IO.File.ReadAllBytes(name));
But one interesting point is, the AppDomain.Load method will load the assembly to the new app domain, as well as to the current domain.
A more elegant solution is to use System.AddIn namespace in 3.5. - http://msdn.microsoft.com/en-us/magazine/cc163476.aspx
Then, you can actually specify the trust level for your addin, using the AddinSecurityLevel like
//Activate the selected AddInToken in a new
//application domain with the Internet trust level.
Calculator CalcAddIn = selectedToken.Activate<Calculator>(AddInSecurityLevel.Internet);
See http://msdn.microsoft.com/en-us/library/bb355219.aspx for details.