I am trying to try some of the mongodb drivers using C # Interactive, but as soon as I try to create MongoClient
, I get the following exception:
> var client = new MongoClient();
Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
+ MongoDB.Driver.Core.Connections.ClientDocumentHelper.CreateOSDocument()
+ Lazy<T>.CreateValue()
+ Lazy<T>.get_Value()
+ MongoDB.Driver.Core.Connections.ClientDocumentHelper.CreateClientDocument(string)
+ MongoDB.Driver.Core.Connections.BinaryConnectionFactory..ctor(MongoDB.Driver.Core.Configuration.ConnectionSettings, MongoDB.Driver.Core.Connections.IStreamFactory, MongoDB.Driver.Core.Events.IEventSubscriber)
+ MongoDB.Driver.Core.Configuration.ClusterBuilder.BuildCluster()
+ MongoDB.Driver.ClusterRegistry.CreateCluster(MongoDB.Driver.ClusterKey)
+ MongoDB.Driver.ClusterRegistry.GetOrCreateCluster(MongoDB.Driver.ClusterKey)
+ MongoDB.Driver.MongoClient..ctor(MongoDB.Driver.MongoClientSettings)
+ MongoDB.Driver.MongoClient..ctor()
Here is the complete information to play: -
Install the latest MongoDB driver through the command line.
C:\dev>nuget.exe install MongoDB.Driver -OutputDirectory tools -ExcludeVersion
Feeds used:
https://api.nuget.org/v3/index.json
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
C:\Program Files\Microsoft SDKs\Service Fabric\packages\
Attempting to gather dependencies information for package 'MongoDB.Driver.2.4.3' with respect to project 'tools', targeting 'Any,Version=v0.0'
Attempting to resolve dependencies for package 'MongoDB.Driver.2.4.3' with DependencyBehavior 'Lowest'
Resolving actions to install package 'MongoDB.Driver.2.4.3'
Resolved actions to install package 'MongoDB.Driver.2.4.3'
Adding package 'MongoDB.Bson.2.4.3' to folder 'C:\dev\tools'
Added package 'MongoDB.Bson.2.4.3' to folder 'C:\dev\tools'
Successfully installed 'MongoDB.Bson 2.4.3' to tools
Adding package 'System.Runtime.InteropServices.RuntimeInformation.4.0.0' to folder 'C:\dev\tools'
Added package 'System.Runtime.InteropServices.RuntimeInformation.4.0.0' to folder 'C:\dev\tools'
Successfully installed 'System.Runtime.InteropServices.RuntimeInformation 4.0.0' to tools
Adding package 'MongoDB.Driver.Core.2.4.3' to folder 'C:\dev\tools'
Added package 'MongoDB.Driver.Core.2.4.3' to folder 'C:\dev\tools'
Successfully installed 'MongoDB.Driver.Core 2.4.3' to tools
Adding package 'MongoDB.Driver.2.4.3' to folder 'C:\dev\tools'
Added package 'MongoDB.Driver.2.4.3' to folder 'C:\dev\tools'
Successfully installed 'MongoDB.Driver 2.4.3' to tools
Open c # dialog and import it into dll
Microsoft (R) Roslyn C
Loading context from 'CSharpInteractive.rsp'.
Type "#help" for more information.
>
>
>
>
Then try to create MongoClient
> var client = new MongoClient();
Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
+ MongoDB.Driver.Core.Connections.ClientDocumentHelper.CreateOSDocument()
+ Lazy<T>.CreateValue()
source
share