I try to install MongoDB C# official driver with Package Manager console in VS2013. It has some dependencies, and they should be installed by commands like this:
Install-Package MongoDB.Bson
But I have got such error for each package:
Install-Package : Could not install package 'MongoDB.Bson 2.4.0'. You are trying to install this package into a project that targets
'.NETFramework,Version=v4.0,Profile=Client', but the package does not contain any assembly references or content files that are compa
tible with that framework. For more information, contact the package author.
At line:1 char:16
+ Install-Package <<<< MongoDB.Bson
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
'.NETFramework,Version=v4.0,Profile=Client',
This is .NET 4.0 Client Profile, which Mongo driver doesn't support.
Maybe you didn't intended to use .NET 4.0 Client Profile. Go to your project properties and switch to .NET 4.5 (because it's the minimum framework version supported by the whole NuGet package).
Related
I am following this beginners tutorial on Microsoft's site.
At this step...
In the PMC, run the following command:
Install-Package Microsoft.EntityFrameworkCore.SqlServer
When I enter that command I get these messages and errors..
PM> Install-Package Microsoft.EntityFrameworkCore.SqlServer
Restoring packages for C:\projects\LazerbaseASPNET\LazerbaseASPNET\LazerbaseASPNET.csproj...
GET https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.sqlserver/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.sqlserver/index.json 208ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.sqlserver/6.0.7/microsoft.entityframeworkcore.sqlserver.6.0.7.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.sqlserver/6.0.7/microsoft.entityframeworkcore.sqlserver.6.0.7.nupkg 71ms
Installed Microsoft.EntityFrameworkCore.SqlServer 6.0.7 from https://api.nuget.org/v3/index.json with content hash D9YV3hc3VSN1qrfdrZcKtMcRLT6bUqj8KtaUdkmO1CH/+meL+8z3Rge5iPhwQ4ol2AwPQlQYVPTTajf9ulSFGg==.
Install-Package : NU1202: Package Microsoft.EntityFrameworkCore.SqlServer 6.0.7 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package
Microsoft.EntityFrameworkCore.SqlServer 6.0.7 supports: net6.0 (.NETCoreApp,Version=v6.0)
At line:1 char:1
+ Install-Package Microsoft.EntityFrameworkCore.SqlServer
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Install-Package : Package restore failed. Rolling back package changes for 'LazerbaseASPNET'.
At line:1 char:1
+ Install-Package Microsoft.EntityFrameworkCore.SqlServer
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Time Elapsed: 00:00:03.2286177
Seems the important one is this...
Package Microsoft.EntityFrameworkCore.SqlServer 6.0.7 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package
Microsoft.EntityFrameworkCore.SqlServer 6.0.7 supports: net6.0
This tutorial is for asp.net core 3.1.. It seems to be the one they recommend for beginners also. I am at a impass and have no idea how to proceed.
EDIT:
I think this is cus I used Visual Studio 2019 which I already had installed for Unity.. asp.net core 3.1 was the only option available for a new project... I think I need to wipe the existing server from azure, download Visual Studio 2022 and start again with a asp.net core 6 app ?
You can try to install entity framework core through the nuget package manager.
Rightclick on your project -> Manage Nuget packages. Before installing select the correct version from the dropdown for the netcore app version you are running.
I think this is cus I used Visual Studio 2019 which I already had installed for Unity.. asp.net core 3.1 was the only option available for a new project.
The solution is wipe the existing server from azure, download Visual Studio 2022 and start again with a asp.net core 6 app.
FML.
I also want to point out that this tutorial is wrong. Earlier in it it says requirement is Visual Studio 2019 16.4 or later.
I did read this and checked the version of Visual studio I had installed, I met the requirements so I kept going.
I am trying to install the package Microsoft.Extensions.DependencyInjection.Abstractions in my Visual Studio 2013 solution as part of a Sitecore installation. The solution has .NET target framework 4.5.2.
The installation fails with
Install-Package : Could not install package 'Microsoft.Extensions.DependencyInjection.Abstractions 1.0.0'. You are trying to install this package into a project that targets
'.NETFramework,Version=v4.5.2', 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 line:1 char:1
+ Install-Package Microsoft.Extensions.DependencyInjection.Abstractions -Version 1 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
I have tried performing the installation in a completely new, empty solution but the installation still fails.
According to the link, there is a dependency to .NETStandard 1.0 but this should be supported by 4.5 according to this.
JaCraig's commment helped me solve this: I upgraded Nuget Package Manager from 2.8 to 2.12. Afterwards, there were no problems with the installation.
In the NuGet Package Manager Console in Visual Studio Express 2012 for Windows 8, I hit
PM > Install-Package UnmanagedExports
I get the following error :
Installing 'UnmanagedExports 1.2.7'.
Successfully installed 'UnmanagedExports 1.2.7'.
Adding 'UnmanagedExports 1.2.7' to JNAExample.
Uninstalling 'UnmanagedExports 1.2.7'.
Successfully uninstalled 'UnmanagedExports 1.2.7'.
Install failed. Rolling back...
Install-Package : Could not install package 'UnmanagedExports 1.2.7'.
You are trying to install this package into a project that
targets'.NETCore,Version=v4.5', 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 line:1 char:1
+ Install-Package UnmanagedExports
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo :
NotSpecified: (:[InstallPackage],InvalidOperationException
+ FullyQualifiedErrorId :
NuGetCmdletUnhandledExceptionNuGet.PowerShell.Commands.InstallPackageCommand
I created a New Project under Visual C# as Class Library.
How to solve this issue ?
The UnmanagedExports NuGet package has an assembly in the lib/net folder inside the NuGet package. Which means it supports projects that target the full .NET Framework, any version. So it does not support UWP projects.
You would need to find another NuGet package, or find the source, if it is available, and compile that in a UWP project or a project that is compatible.
I use Visual Studio Community 2015
Version 14.0.25123.00 Update 2
NuGet Package Manager 3.4.4
When trying to install Microsoft.AspNetCore.Mvc package in a .NET 4.6.1 console Application project, I get the following error:
install-package : Could not install package 'runtime.native.System 4.0.0-rc2-24027'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6.1', 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 line:1 char:1
+ install-package Microsoft.AspNetCore.Mvc -pre
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Can anyone help me out ?
Basically you can not install Microsoft.AspNetCore.Mvc in a console Application. In a console application from Microsoft.AspNetCore.* you can install only Microsoft.AspNetCore.Authentication.ActiveDirectory.
To prove this try this way:
Right click in the references
Chose Manage Nuget Packages...
From 3 tabs (Browse, Installed, Updates) choose Browse tab.
Write in the search box Microsoft.AspNetCore.
The reason you can not install that your application is simply a console app not MVC structure.
I need to use json.net for json serialization and deserialization, but I have the problem with installing this package. As I saw on the website it supports wp 7.1 and silverilight. When I'm typing in console Install-Package Newtonsoft.Json
Installing 'Newtonsoft.Json 6.0.1'.
Successfully installed 'Newtonsoft.Json 6.0.1'.
Adding 'Newtonsoft.Json 6.0.1' to Connected.
Uninstalling 'Newtonsoft.Json 6.0.1'.
Successfully uninstalled 'Newtonsoft.Json 6.0.1'.
Install failed. Rolling back...
Install-Package : Could not install package 'Newtonsoft.Json 6.0.1'. You are trying to install this package into a project tha
t targets 'Silverlight,Version=v4.0,Profile=WindowsPhone71', but the package does not contain any assembly references or conte
nt files that are compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package Newtonsoft.Json
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
How to solve this issue ?
How it should be properly done ?
With windows phone 7, you should probably install the older version of that package, such as 5.0.1. You can do Install-package Newtonsoft.Json -version 5.0.1
right click on dll,in general tab,security section
and unblock it
thanks to :
http://crodrigues.com/referencing-json-net-in-windows-phone-8/