The package requires NuGet client version '3.6.0' or above - c#

I want to install Microsoft.EntityFrameworkCore and its component. I am using Visual Studio 2015 with NuGet Client version previously 3.5.0 and now I have 3.6.0-rtm-2511 (which is the latest) downloaded from https://www.nuget.org/downloads as instructed by error report. I don't know why issue still persist that I need to have 3.6.0 or higher.
How to update my NuGet Package Manager in other way?
I can't find my Nuget Package Manager for Visual Studio in Update from Tools > Extension and Updates > Updates > Visual Studio Gallery.
I can only see it in Tools > Extension and Updates > Installed but there is no update for it but I noticed that 'Automatically update this extension' is checked.
Result from PM Console
PM> install-package microsoft.entityframeworkcore.sqlserver
GET https://api.nuget.org/v3/registration3-gz-semver2/microsoft.entityframeworkcore.sqlserver/index.json
OK https://api.nuget.org/v3/registration3-gz-semver2/microsoft.entityframeworkcore.sqlserver/index.json 329ms
Retrieving package 'Microsoft.EntityFrameworkCore.SqlServer 2.1.1' from 'nuget.org'.
Install failed. Rolling back...
Uninstalling NuGet package Microsoft.EntityFrameworkCore.SqlServer.2.1.1.
Executing nuget actions took 162.34 ms
install-package : The 'Microsoft.EntityFrameworkCore.SqlServer 2.1.1' package requires NuGet client version '3.6.0' or above, but the current NuGet
version is '3.6.0-rtm-2511'. To upgrade NuGet, please go to http://docs.nuget.org/consume/installing-nuget
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:33.0573364

The package requires NuGet client version '3.6.0' or above
This is a known issue about nuget. NuGet team fixed it for Nuget 4 which comes with VS2017, but 2015 users are left behind.
Ticket: https://github.com/NuGet/Home/issues/6403
Besides, NuGet team will consider a fix. At this time there are no plans to release a new version of NuGet for VS 2015.
So if you want to use the package Microsoft.EntityFrameworkCore.SqlServer 2.1.1, you have to update your Visual Studio 2015 to Visual Studio 2017. Or if the lower version of this package is acceptable to you, you can use the version Microsoft.EntityFrameworkCore.SqlServer 2.0.3
Hope this helps.

Edit the files:
%userprofile%\.nuget\packages\microsoft.entityframeworkcore\3.1.8\microsoft.entityframeworkcore.nuspec
%userprofile%\.nuget\packages\microsoft.entityframeworkcore.abstractions\3.1.8\microsoft.entityframeworkcore.abstractions.nuspec
%userprofile%\.nuget\packages\microsoft.entityframeworkcore.analyzers\3.1.8\microsoft.entityframeworkcore.analyzers.nuspec
%userprofile%\.nuget\packages\microsoft.entityframeworkcore.relational\3.1.8\microsoft.entityframeworkcore.relational.nuspec
%userprofile%\.nuget\packages\microsoft.entityframeworkcore.tools\3.1.8\microsoft.entityframeworkcore.tools.nuspec
Change line 3 from:
<metadata minClientVersion="3.6">
to:
<metadata minClientVersion="3.6.0-rtm-2511">
Now go back to the Package Manager Console and try the install again:
Worked for me.

Try installing the package from Nuget Package Manager (Manage NuGet Packages)and not from console. The package manager will provide you option to update your NUGET application. Look in the 'Visual Studio Gallery' section of the 'Extension and Updates' window that pops up.

Related

'4.6.0-preview6.19303.8' is not a valid version string. Unable to Install Nuget Packages in Visual Studio 2013

Usually I work on .NET 4.5, My colleague had .NET 4.6.2 installed on his machine, gave me Project for me to do changes.
In Nuget Console, following below error is displayed
'4.6.0-preview6.19303.8' is not a valid version string.
I am trying hard to Update Nuget Packages it shows me below error, what does it mean..
PM> Install-Package Microsoft.Owin.Host.SystemWeb -Version 4.1.0
Attempting to resolve dependency 'Owin (≥ 1.0.0)'.
Attempting to resolve dependency 'Microsoft.Owin (≥ 4.1.0)'.
Installing 'Microsoft.Owin 4.1.0'.
You are downloading Microsoft.Owin from Microsoft, the license agreement to which is available at https://raw.githubusercontent.com/aspnet/AspNetKatana/v4.0.1/LICENSE.txt. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
Successfully installed 'Microsoft.Owin 4.1.0'.
Installing 'Microsoft.Owin.Host.SystemWeb 4.1.0'.
You are downloading Microsoft.Owin.Host.SystemWeb from Microsoft, the license agreement to which is available at https://raw.githubusercontent.com/aspnet/AspNetKatana/v4.0.1/LICENSE.txt. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
Successfully installed 'Microsoft.Owin.Host.SystemWeb 4.1.0'.
Install failed. Rolling back...
Install-Package : '4.6.0-preview6.19303.8' is not a valid version string.
At line:1 char:1
+ Install-Package Microsoft.Owin.Host.SystemWeb -Version 4.1.0
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], ArgumentException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
Any help will be appreciated. Thank you :)
After Nuget Update, Got to know Nuget is up to date
PM> nuget update -self
Checking for updates from https://api.nuget.org/v3/index.json.
CACHE https://api.nuget.org/v3/registration5-gz-semver2/nuget.commandline/index.json
Currently running NuGet.exe 5.5.1.
NuGet.exe is up to date.
Update successful.
Looks like it's related to nuget version, as stated in the documentation:
NuGet 4.3.0+ supports SemVer 2.0.0, which supports pre-release numbers with dot notation, as in 1.0.1-build.23. Dot notation is not supported with NuGet versions before 4.3.0. You can use a form like 1.0.1-build23.
In your case, 4.6.0-preview6.19303.8 is a "pre-release numbers with dot notation" (the '.' between "preview6" and "19303").
You can check the nuget version you're using by typing nuget help in the Package Manager Console of Visual Studio, then update it with nuget update -self
Additionally, it appears that there is also limitation on the version of Visual Studio:
Certain semantics of SemVer v2.0.0 are not supported in older clients. NuGet considers a package version to be SemVer v2.0.0 specific if either of the following statements is true:
The pre-release label is dot-separated, for example, 1.0.0-alpha.1
and
If you upload a SemVer v2.0.0-specific package to nuget.org, the package is invisible to older clients and available to only the following NuGet clients:
NuGet 4.3.0+
Visual Studio 2017 version 15.3+
Visual Studio 2015 with NuGet VSIX v3.6.0
dotnet
dotnetcore.exe (.NET SDK 2.0.0+)

Unable to install package UnmanagedExports

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.

Nuget: Failed to add reference to 'EntityFramework'

I tried to update a few packages using Package Manager Console, but I am getting this:
update-package : Failed to add reference to 'EntityFramework'.
At line:1 char:1
+ update-package EntityFramework -reinstall
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Update-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.UpdatePackageCommand
Here are a few commands that I tried:
Install-Package EntityFramework
Update-Package EntityFramework -Reinstall
Update-Package -Reinstall
I also tried to update packages using UI and ran VS in administrator mode. Important to mention, the project is under TFS source control (I did make it work when I removed TFS binding). There are a few other packages - same thing with them. I see yellow exclamation next to references and I can't re-install packages.
I've never seen this error before, similar question answers don't work for me.
In my case packages where checked in TFS source control (which is of course terrible). This answer explains how to setup ignore rules for TFS. After deleting packages everything was fixed.
I've tried your commands on one of my project that under VSTS source control, no issue occurred (VS 2015.3 + Package Manager Console Host Version 3.5.0.1484). You may try the items below:
Check Package Manager Console version to see whether it is the latest version.
Try to open the package from Manage Nuget Packages, uninstall the EntityFramework package and re-install it:
Enable Package restore in VS:

Installing Entity Framework fails in Visual Studio 2015

I'm reading/coding along with the Apress book Pro ASP.NET MVC 5 by Adam Freeman. In chapter 7 (p. 174), we're supposed to install Entity Framework using the following commands:
Install-Package EntityFramework -projectname SportsStore.Domain
Install-Package EntityFramework -projectname SportsStore.WebUI
But this fails. Here is the output:
Attempting to gather dependencies information for package 'EntityFramework.6.1.3' with respect to project 'SportsStore.Domain', targeting '.NETFramework,Version=v4.5.1'
Attempting to resolve dependencies for package 'EntityFramework.6.1.3' with DependencyBehavior 'Lowest'
Resolving actions to install package 'EntityFramework.6.1.3'
Resolved actions to install package 'EntityFramework.6.1.3'
Adding package 'EntityFramework.6.1.3' to folder 'C:\git\SportsStore\packages'
Added package 'EntityFramework.6.1.3' to folder 'C:\git\SportsStore\packages'
Added package 'EntityFramework.6.1.3' to 'packages.config'
Executing script file 'C:\git\SportsStore\packages\EntityFramework.6.1.3\tools\init.ps1'
Executing script file 'C:\git\SportsStore\packages\EntityFramework.6.1.3\tools\install.ps1'
Type 'get-help EntityFramework' to see all available Entity Framework commands.
Successfully installed 'EntityFramework 6.1.3' to SportsStore.Domain
Install failed. Rolling back...
Removed package 'EntityFramework 6.1.3' from 'packages.config'
Removing package 'EntityFramework 6.1.3' from folder 'C:\git\SportsStore\packages'
Access to the path 'C:\git\SportsStore\packages\EntityFramework.6.1.3\tools\EntityFramework.PowerShell.Utility.dll' is denied.
Access to the path 'EntityFramework.PowerShell.Utility.dll' is denied.
Removed package 'EntityFramework 6.1.3' from folder 'C:\git\SportsStore\packages'
Install-Package : An item with the same key has already been added.
At line:1 char:1
+ Install-Package EntityFramework -projectname SportsStore.Domain
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
One or more packages could not be completely uninstalled: 'C:\git\SportsStore\packages\EntityFramework.6.1.3'. Restart Visual Studio to finish uninstall.
The book is instructing us to install specific versions of all other libraries (e.g. Microsoft.Aspnet.Mvc 5.0.0), but does not mention which version of EF to install, so I've tried installing different versions of EF, but keep getting the same error. (Install failed. Rolling back...)
I'm running VS2015 as administrator.
Seems NuGet itself was causing these issues (probably related to https://github.com/NuGet/Home/issues/1239, as I was seeing the same 'always rolling back' issue as discussed in that thread)
Updating NuGet solved it for me. (Updated from version 3.0.60624.657 to 3.1.60724.766)
These references were set up earlier in the project:
SportsStore.WebUI -> SportsStore.Domain
SportsStore.UnitTests -> SportsStore.Domain and SportsStore.WebUI
I removed the references for each project and then ran the install-package command for the Entity Framework as directed. That worked fine.
I then re-added the references.
Try to remove all the EF nuget packages installed on your solution and then reinstall the only one that you need.
Try to disconnect references between projects and than try to install EF. Hope it'll help
Relaunching Visual Studio as Admin and retry to install the package did the trick for me.

How to install EntityFramework 5.0 (and other older versions) from NuGet?

I installed EF 5.0 into the .DAL, now I want to install EF 5.0 into .BLL from Nuget
But the default online Nuget package always comes up with 6.0, which gives error when used together with the 5.0 EF I use in DAL.
Where can I install the 5.0 version of EntityFramework into my Nuget packages??
View -> Other windows -> Package Manager Console then run
install-package entityframework -version 5.0.0.0.
Add -project <project.name> if you want to install it in a specific project.
here is what I experienced: (before I begin... kudos to devnull for the answer).
I clicked on:
1) View -> Other windows -> Package Manager Console then ran
2) install-package entityframework -version 5.0.0.0.
The uninstall started, but then rolled back, as it detected I already had installed Entity Framework (EF) 6.0.2 ...
>PM> install-package entityframework -version 5.0.0.0
Installing 'EntityFramework 5.0.0'.
You are downloading EntityFramework from Microsoft, the license agreement to which is available at http://go.microsoft.com/fwlink/?LinkId=253898&clcid=0x409. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
Successfully installed 'EntityFramework 5.0.0'.
*****Install failed. Rolling back...*****
install-package : Already referencing a newer version of 'EntityFramework'.
At line:1 char:1
+ install-package entityframework -version 5.0.0.0
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
So then I uninstalled the Entity Framework 6.0.2 and found it had a dependency that also needed to be removed... then I was finally able to uninstall the Entity Framework 6.0.2 and then add the Entity Framework 5.0.0.0
PM> uninstall-package entityframework -version 6.0.2
uninstall-package : Unable to uninstall 'EntityFramework 6.0.2' because 'AnotherFakeDbSet 3.0.0.0' depends on it.
So then I uninstalled these two and installed Entity Framework 5.0.0.0
PM> uninstall-package AnotherFakeDbSet -version 3.0.0.0
PM> uninstall-package entityframework -version 6.0.2
PM> install-package entityframework -version 5.0.0.0
I like the console... quicker than searching for the packages if you know the version #. And if you haven't checked out "Powershell" (the basis for the console -- I find it's time well spent - it allows for virtually unlimited automation)
Older versions of Entity Framework or other similar packages can be installed using Package Manager Console only in earlier versions of Visual Studio (prior to 2015). In Visual Studio 2015 there is an option of manually selecting version before install but in Visual Studio 2010,2012 you need to use package manager console only.
Simple browse to the link Nuget Explorer and click on the specific entity version that you have to install.
You'll see that Studio automatically shows the Package Manager console code.
For example I was working on a project that required Entity Framework 4.1 So here was my code. Entity Framework Package Manager Console Command Snapshot

Categories