I am making a worker role that makes appDomain and loads a class on that appDomain so it can execute some methods. Class that i want to load in appDomain (called Loader) is in the same dll as the worker role. when I try to load the class in appDomain using this line
Loader ld = (Loader)domain.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName, typeof(Loader).FullName);
I get a file not found exception:
System.IO.FileNotFoundException was unhandled
Message: An unhandled exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
Additional information: Could not load file or assembly 'Calculation Node, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
I suspect that the problem is of "access rights" nature.
Is there some setting that I need to enable for that worker role or something?
I have set ComVisible(true) on assembly as well as on the Loader class. This didn't help
I should mention also that I am executing the worker role on an emulator.
Thanks in advance,
Nenad Rakic
Ok, i found solution so I think it is a good idea to share it. Before creating new appDomain, you need to create setup wich will have base directory defined and set to executing dll location, like so:
This setup is then passed to
AppDomain.CreateDomain();