Re: Assembly.LoadFrom



Also note:

LoadFrom: .NET caches the assembly, so if the assembly was already loaded
earlier (assembly with no strong name) it returns the first assembly loaded
(hashed by name?), regardless of version number. The path is basically
ignored.
This method also looks for and loads all dependant assembly items.

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

Also Load and/or LoadFile only loads the specified assembly, and not the
related/dependant items, which can cause problems.

Eric Schneider


"Linda Liu[MSFT]" <v-lliu@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:eb%23DT2YXIHA.4200@xxxxxxxxxxxxxxxxxxxxxxxxx
Hi Luis,

I performed several tests on this issue and the result I got is that as
long as a strong-named assembly is added to the GAC, the Load or LoadFrom
or LoadFile method of the Assembly class always loads and returns the
assembly cached in the GAC, no matter whether there's the same assembly
file in the same path of the executable.

So the Runtime always checks the GAC to search for the required assembly
first and then check the application directory if there's no matching in
the GAC. This is behavior is by design and unfortunately we have no chance
to change it.

The workaround to your problem is to uninstall your assembly from the GAC
and copy the assembly file to the application directory(if necessary).

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.



.



Relevant Pages

  • RE: Custom Module will not debug
    ... is "Kailua.dll" your custom module? ... The .Net loader will first probe the system GAC before probing your private ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.vsnet.debugging)
  • RE: Custom Module will not debug
    ... .Net loader will only probe GAC for strong named assembly. ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.vsnet.debugging)
  • Re: Auto-updating GAC; loading from GAC vs. server
    ... When you're saying "Auto-updating GAC", do you mean assemblies ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.general)
  • RE: Global.asax not checking the GAC
    ... Here is the MSDN reference about Assembly Name: ... Microsoft MSDN Online Support Lead ... from the community or a Microsoft Support ... Global.asax not checking the GAC ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Assembly.LoadFrom
    ... from some assemblies, such as: ... This method also looks for and loads all dependant assembly items. ... long as a strong-named assembly is added to the GAC, ... Microsoft Online Community Support ...
    (microsoft.public.dotnet.framework)