DEV Community

Bruce Axtens
Bruce Axtens

Posted on

When Assembly.LoadFrom doesn't do what you expect

Today I re-discovered the value of RTFM (Read The Friendly Manual). I was wondering why

var assem = Assembly.LoadFrom("packages\Google.Apis.Core.1.21.0\lib\net45\Google.Apis.Core.dll");
Enter fullscreen mode Exit fullscreen mode

was giving me, for assem.FullName

Google.Apis.Core, Version=1.41.1.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab
Enter fullscreen mode Exit fullscreen mode

It's all explained in the dotnet api documentation, specifically

If an assembly with the same identity is already loaded, LoadFrom returns the loaded assembly even if a different path was specified.

This is an explanation that stops me heading off to DEV or StackOverflow for help (that would inevitably point me to the friendly documentation that I should have read in the first instance). For all that, it's still VERY annoying.

LATER
A solution to my problem was found at (hmm) read the docs

Top comments (0)