Assembly.LoadFrom()... that way lies madness.
What's happening when you call LoadFrom() is that you're getting a private
copy of the assembly. It doesn't act like an implicitly loaded assembly, so
when you try to create a type based on its fully qualified name, your
privately loaded copy is not able to provide it.
I'd strongly advise to do this instead:
Assembly.Load(AssemblyName.GetAssemblyName(filename));
rather than Assembly.LoadFrom().
On Fri, Jun 6, 2008 at 12:23 PM, Mike Andrews <[EMAIL PROTECTED]>
wrote:
> I'm having difficulty getting Type.GetType(...) and
> Activator.CreateInstance
> working.
>
> I've loaded an assembly into the AppDomain using Assembly.LoadFrom(...). I
> can look at the AppDomain.GetAssemblies() method and see that the assembly
> is loaded. However, when I try to create a type from that assembly I get
> this exception:
>
> Could not load file or assembly 'xxxxxxxxx, Version=1.0.0.0,
> Culture=neutral, PublicKeyToken=null' or one of its dependencies. The
> system
> cannot find the file specified.
> However, if I use the Assembly object from the AppDomain.GetAssemblies()
> method and execute the CreateInstance() method it works.
>
> Any ideas what's going on here?
>
> I was under the impression that Type.GetType(...) searched the AppDomain
> for
> the assembly.
>
> Thanks,
> Mike
>
> ===================================
> This list is hosted by DevelopMentor(R) http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com
>
--
http://bradwilson.typepad.com/
http://www.flickr.com/photos/dotnetguy/
http://www.last.fm/user/dotnetguy/
===================================
This list is hosted by DevelopMentor� http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com