load assembly into new App Domain

R

Ron M. Newman

Hi, the load method of the AppDomain doesn't take a string filename. If you
have a new AppDomain object you created and a string with the full pathname
of an assembly, how do you load it there? I can't seem to find examples
involving filenames.

thanks,
Ron
 
R

Ron M. Newman

I was able to find this example:
Load(AssemblyName.GetAssemblyName(filename))

Is the AssemblyName class really required?

Ron
 
J

Jon Shemitz

Ron M. Newman said:
I was able to find this example:
Load(AssemblyName.GetAssemblyName(filename))

Is the AssemblyName class really required?

No. Look at AppDomain.Load(string).
 
R

Ron M. Newman

Hi,

Filename is: "c:\\folder\\myassembly.dll"

when I use MyDomain.Load(AssemblyName.GetAssemblyName(filename)) it works
perfectly.
when I use MyDomain.Load(filename) it throws a
System.IO.FileLoadExceptionexception claiming it cannot load.

How come?

Ron
 
J

Jon Shemitz

Ron M. Newman said:
Filename is: "c:\\folder\\myassembly.dll"

when I use MyDomain.Load(AssemblyName.GetAssemblyName(filename)) it works
perfectly.
when I use MyDomain.Load(filename) it throws a
System.IO.FileLoadExceptionexception claiming it cannot load.

How come?

Apparently, I have only used Load(string) with assemblies in the app
directory.
 
M

Michael Nemtsev

Hello Ron,

Try to use MyDomain.LoadFrom
RN> Hi,
RN>
RN> Filename is: "c:\\folder\\myassembly.dll"
RN>
RN> when I use MyDomain.Load(AssemblyName.GetAssemblyName(filename)) it
RN> works
RN> perfectly.
RN> when I use MyDomain.Load(filename) it throws a
RN> System.IO.FileLoadExceptionexception claiming it cannot load.
RN> How come?
RN>
RN> Ron
RN>
RN> RN>---
WBR,
Michael Nemtsev [C# MVP] :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top