nuget retrieving package metadata

2019-01-11 22:01发布

问题:

An error occurred while retrieving package metadata for 'bootstrap.3.3.5' from source 'nuget.org'. ========== Finished ==========

Where the defect wonder Is site nuget.org may crash or whether the problem is local. I am using Visual Basic on Windows. The defect begins when he wishes to download entity framework package, but he does not accept the download nuget from the official website Package.

Is there an interpretation of what is happening?

meaning that when I use Visual Basic to design sites and dealing with databases through asp.net web application when I INSTALL a package through the attached nuget within Visual Basic, I was having errors that in the previous picture and knowing that I go to the page https://www.nuget.org asked Install NuGet . exe does not accept the download intent Is the problem in the computer or is it public to everyone.

An error occurred while retrieving package metadata for

I noticed there was a update for Visual Studio 2015 NuGet Package Manage for Visual Studio to version 3.1.60724.766 (from current 3.0.60624.657), so I downloaded and installed it. Same errors.

Fix

In Visual Studio 2015.

Tools Menu -> NuGet Package Manager -> Package Manager Settings

Click Package Sources

Click + sign

Add the following:

Name: something like NuGet v2

Source: https://www.nuget.org/api/v2/

Untick the current nuget.org so it should look like: look like

And now you should be able to install NuGet packages

&&

Each package is licensed to you by its owner. Microsoft is not responsible for, nor does it grant any licenses to, third-party packages. Some packages may include dependencies which are governed by additional licenses. Follow the package source (feed) URL to determine any dependencies.

Package Manager Console Host Version 3.0.0.0

Type 'get-help NuGet' to see all available NuGet commands.

PM> get-help NuGet TOPIC about_NuGet

SHORT DESCRIPTION Provides information about NuGet Package Manager commands.

LONG DESCRIPTION This topic describes the NuGet Package Manager commands. NuGet is an integrated package management tool for adding libraries and tools to .NET projects.

The following NuGet cmdlets are included.

    Cmdlet                  Description
    ------------------      ----------------------------------------------
    Find-Package            Get the set of packages available from the package source, 
                            based on the package Id/keyword. This is a new command that
                            will replace Get-Package -ListAvailable.

    Get-Package             Gets the set of installed packages. With -Updates switch, 
                            gets the set of package updates available from the package source.

    Install-Package         Installs a package and its dependencies into the project.

    Uninstall-Package       Uninstalls a package. If other packages depend on this package, 
                            the command will fail unless the –Force option is specified.

    Update-Package          Updates a package and its dependencies to a newer version.

    Sync-Package            Get the version of installed package from specified/default project
                            and sync the version to the rest of projects in the solution.

    Add-BindingRedirect     Examines all assemblies within the output path for a project
                            and adds binding redirects to the application (or web) 
                            configuration file where necessary.

    Get-Project             Returns a reference to the DTE (Development Tools Environment) 
                            for the specified project. If none is specifed, returns the 
                            default project selected in the Package Manager Console.

    Open-PackagePage        Open the browser pointing to ProjectUrl, LicenseUrl or 
                            ReportAbuseUrl of the specified package.

    Register-TabExpansion   Registers a tab expansion for the parameters of a command.

SEE ALSO Online documentation: ht tp://g o .m icrosoft . com / fwlink /? LinkID=206619 Find-Package Get-Package Install-Package Uninstall-Package Update-Package Sync-Package Add-BindingRedirect Get-Project Open-PackagePage Register-TabExpansion PM>

All this and still the service does not work

回答1:

It requires two steps (second is maybe optional, but I always like clean solution)

  1. In Explorer open folder where your project resides. Open packages.config using Notepad. Find and remove the line that mentions corrupted package name.

  2. Open folder where your solution resides. Open subfolder "packages". Find folder with corrupted package and remove it.

Note: If you delete wrong package, just enable NuGet restore in Visual studio "Options", and while enabled, right-click solution and select "Restore missing NuGet packages"



回答2:

My problem was due to outdated Package Manager. Go to VS menu Tools > Extensions and Updates > Updates and check if there is no updates for NuGet Package Manager. Installing the latest version solved the problem for me.

PS: Removing package reference as was suggested by Hrvoje Matić, cures the headache not by curing it but by amputating your head - those package will not be manageable anymore.



回答3:

I got the same issue recently and I found my nuget.exe is 2.*. I think it's not compatible with nuget feed v3.

So I solve it by simply upgrading nuget.exe to 3.*.



回答4:

Speaking more generically, in my case it was an issue with NUnit 3.8.1. I downgraded to an earlier version of NUnit and the problem went away. I didn't have time to investigate what the cause was.



回答5:

Open the solution in Visual studio -> Navigate to packages.config file 1/ copy the package attribute of corrupted package that you see in the error console. Remove that corrupted package attribute from package element 2/ save packages.config file and then run nuget command 3/ when successfull, place back the package attribute