user3598759
user3598759

Reputation: 1

Why doesn't monodevelop install mongodriver via NuGet?

When I create a console project in MonoDevelop and try to add a package via NuGet, my application stops and shows this error:

Adding 'MongoDB.Bson 2.1.0' to NugetEx.
Could not install package 'MongoDB.Bson 2.1.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
System.InvalidOperationException: Could not install package 'MongoDB.Bson 2.1.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
  at NuGet.ProjectManager.ExtractPackageFilesToProject (IPackage package) [0x00000] in <filename unknown>:0 
  at NuGet.ProjectManager.AddPackageReferenceToProject (IPackage package) [0x00000] in <filename unknown>:0 
  at NuGet.ProjectManager.Execute (NuGet.PackageOperation operation) [0x00000] in <filename unknown>:0 
  at NuGet.ProjectManager.Execute (IPackage package, IPackageOperationResolver resolver) [0x00000] in <filename unknown>:0 
  at NuGet.ProjectManager.AddPackageReference (IPackage package, Boolean ignoreDependencies, Boolean allowPrereleaseVersions) [0x00000] in <filename unknown>:0 
  at NuGet.ProjectManager.AddPackageReference (System.String packageId, NuGet.SemanticVersion version, Boolean ignoreDependencies, Boolean allowPrereleaseVersions) [0x00000] in <filename unknown>:0 
  at ICSharpCode.PackageManagement.SharpDevelopPackageManager.AddPackageReference (IPackage package, Boolean ignoreDependencies, Boolean allowPrereleaseVersions) [0x00000] in <filename unknown>:0 
  at ICSharpCode.PackageManagement.SharpDevelopPackageManager.InstallPackage (IPackage package, ICSharpCode.PackageManagement.InstallPackageAction installAction) [0x00000] in <filename unknown>:0 
  at ICSharpCode.PackageManagement.PackageManagementProject.InstallPackage (IPackage package, ICSharpCode.PackageManagement.InstallPackageAction installAction) [0x00000] in <filename unknown>:0 
  at ICSharpCode.PackageManagement.InstallPackageAction.ExecuteCore () [0x00000] in <filename unknown>:0 
  at ICSharpCode.PackageManagement.ProcessPackageAction.Execute () [0x00000] in <filename unknown>:0 
  at ICSharpCode.PackageManagement.PackageActionRunner.Run (IPackageAction action) [0x00000] in <filename unknown>:0 
  at ICSharpCode.PackageManagement.PackageViewModel.InstallPackage (IEnumerable`1 packageOperations) [0x00000] in <filename unknown>:0 
  at ICSharpCode.PackageManagement.PackageViewModel.InstallPackage () [0x00000] in <filename unknown>:0 
  at ICSharpCode.PackageManagement.PackageViewModel.TryInstallingPackage () [0x00000] in <filename unknown>:0

Upvotes: 0

Views: 385

Answers (1)

Pierre-Luc Pineault
Pierre-Luc Pineault

Reputation: 9201

Read that part of the error message:

Could not install package 'MongoDB.Bson 2.1.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0'

If we take a look at the official driver page, we can confirm that Mongo 2.1.0 and .Net4 are indeed not compatible :

Mongo driver compatibility table

As stated in the table above, you should install the version 1.10 instead.

However, that version does not seem to be available on NuGet. You will have to do a manual download on their GitHub page for version 1.10


The way I verified if the version was available on NuGet, was with the following command:

Get-Package Mongo.BSon -ListAvailable -AllVersions

If it had been available, you could have used the following to install a specific version:

Install-Package Mongo.BSon -Version 1.10

Upvotes: 2

Related Questions