I am trying to load the dll for Microsoft.Azure.Search.Common.5.0.2 at runtime. From what I see on the nuget page, and from what nuget downloads when installing this, it depends upon Microsoft.Rest.ClientRuntime.2.3.12 . However, when I directly try to load the Azure.Search.Common dll using the following:-
Assembly.LoadFrom(dllPath).GetTypes().Select(t => t.Namespace).Distinct().ToList<string>();
I get the following Loader Exception:-
{"Could not load file or assembly 'Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.":"Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"}
I am loading the dll after installing from nuget. Specifically, I am the loading the following dll:
Microsoft.Azure.Search.Common\Microsoft.Azure.Search.Common.5.0.2\lib\net452\Microsoft.Azure.Search.Common.dll
Just to be sure, I have also gone though my csproj and config files, to check for some version redirection, but that doesn't seem to be the case.
Context: I want to know all possible namespaces that a project might be using, hence I am downloading and loading all nuget packages to get their namespaces, amongst other things.
EDIT:
I tried to further analyse the dll by loading it into ILSpy. On loading the dll, ILSpy also shows that it refers to version 2.0.0.0 of Microsoft.Rest.ClientRuntime. It also fails to load that references and gives the following errors:-
// Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 // Assembly reference loading information: // There were some problems during assembly reference load, see below for more information! // Error: Could not find reference: Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (unresolved) // Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed (unresolved) // Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 // Assembly reference loading information: // There were some problems during assembly reference load, see below for more information! // Error: Could not find reference: Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Microsoft.Azure.Search.Common.dll
trying loadingversion 2.0
ofMicrosoft.Rest.ClientRuntime
which is missing from output directory – rahulaga_dev