Home All Groups Group Topic Archive Search About
Author
10 Aug 2006 3:41 AM
Neil58
The following code when run generates a file not found exception:
AssemblyName aName = new AssemblyName();
aName.Name = "Martee.Entity";
Assembly assembly = Assembly.Load(aName);

on the other hand, this runs OK:
Assembly assembly = Assembly.LoadWithPartialName("Martee.Entity");

Martee.Entity is in the GAC, but Load doesn't seem to be able to find it. 
I'd rather not use LoadWithPartialName because it's obsolete, but I'm not
sure what to replace it with.  Can anyone suggest something?

Author
10 Aug 2006 2:19 PM
Keith
Not really familiar with loading assemblies at runtime, but can't you just
copy the Martee.Entity to your local bin/executable folder?

Show quote
"Neil58" wrote:

> The following code when run generates a file not found exception:
> AssemblyName aName = new AssemblyName();
> aName.Name = "Martee.Entity";
> Assembly assembly = Assembly.Load(aName);
>
> on the other hand, this runs OK:
> Assembly assembly = Assembly.LoadWithPartialName("Martee.Entity");
>
> Martee.Entity is in the GAC, but Load doesn't seem to be able to find it. 
> I'd rather not use LoadWithPartialName because it's obsolete, but I'm not
> sure what to replace it with.  Can anyone suggest something?
Author
10 Aug 2006 2:26 PM
Keith
Sorry, my last example was assuming you were doing a "LoadFrom()".  If you're
doing a Load(), use the fully-qualified assembly name:

Load("System.data, version=1.0.3300.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089")

http://msdn2.microsoft.com/en-us/library/k8xx4k69.aspx

Show quote
"Neil58" wrote:

> The following code when run generates a file not found exception:
> AssemblyName aName = new AssemblyName();
> aName.Name = "Martee.Entity";
> Assembly assembly = Assembly.Load(aName);
>
> on the other hand, this runs OK:
> Assembly assembly = Assembly.LoadWithPartialName("Martee.Entity");
>
> Martee.Entity is in the GAC, but Load doesn't seem to be able to find it. 
> I'd rather not use LoadWithPartialName because it's obsolete, but I'm not
> sure what to replace it with.  Can anyone suggest something?

AddThis Social Bookmark Button