0

I want to create an application domain with default permissions and load assembly into the application domain with default privileges and execute the methods inside the assembly.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user490706
  • 71
  • 1
  • 3
  • 8

2 Answers2

7

You may take a look at the following article on MSDN. Or if you want to construct an instance of some type inside another AppDomain (assuming this type has a default constructor):

var domain = AppDomain.CreateDomain("NewAppDomain");
var path = @"C:\work\SomeAssembly.dll";
var t = typeof(SomeType);
var instance = (SomeType)domain.CreateInstanceFromAndUnwrap(path, t.FullName);

The instance variable returned with this method lives on your newly created application domain and you are ready to manipulate it.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
0

Perhaps this helps

Can I reload an assembly in Mono CSharpRepl?

var dom = AppDomain.CreateDomain("tmp");
dom.Load("System.Core");
AppDomain.Unload(dom);

See also

Using multiple versions of the same DLL

Community
  • 1
  • 1
sehe
  • 374,641
  • 47
  • 450
  • 633