In my project (running un .NET 4.5) I'm loading in ReflectionOnly
context an assembly, which one of it's dependencies is System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
.
When I'm trying to load it with:
Assembly.ReflectionOnlyLoad("System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
I'm getting this exception:
Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
How can I load this type properly?
To resolve this issue, you need to ensure that the assembly and its dependencies are available in the application's probing path.
Here are a few possible solutions:
Once you have added the assembly and its dependencies to the application's probing path, you should be able to load it using Assembly.ReflectionOnlyLoad.