2015-10-19 44 views
0

當我創建MonoDevelop的一個控制檯項目,並嘗試通過的NuGet添加一個包,我的應用程序將停止,並顯示以下錯誤:monodevelop爲什麼不通過NuGet安裝mongodriver?

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 
+1

這是更大包的一部分,就像MongoDb驅動程序? –

+0

您必須安裝驅動程序才能使用mongoDB(這在doc中告訴)。 – user3598759

+0

你正在安裝整個驅動程序,還是隻是試圖安裝這個依賴包? –

回答

2

讀取錯誤消息的那部分:

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'

如果我們來看看official driver page,我們可以證實,蒙戈2.1.0和.NET4確實不兼容:

Mongo driver compatibility table

由於在T表示在上面,你應該安裝1.10版本。

但是,該版本似乎沒有在NuGet上可用。你將不得不做一個手動下載他們的GitHub page for version 1.10


我驗證如果版本可用上的NuGet,是用下面的命令方式:

Get-Package Mongo.BSon -ListAvailable -AllVersions 

如果它已經可用,本來可以使用以下方式安裝特定版本:

Install-Package Mongo.BSon -Version 1.10 
+0

謝謝,你真的幫我 – user3598759

相關問題