Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NuGet Pack -- Failed to retrieve information from remote source

Tags:

nuget

I am trying to run:

nuget pack project.csproj

but because of the directory structure of the project:

A\B\C\Project

it keeps saying:

NuGet.Protocol.Core.Types.FatalProtocolException: Failed to retrieve information from remote source 'A\B\Packages', which it really should be 'A\Packages'. How do I change where NuGet looks for packages while establishing dependencies.

I have tried putting a NuGet.config in both the project directory as well as the Solution (in .nuget). I added this to the file:

<config>
    <add key="repositoryPath" value="A\Packages" />
</config>

in both places and it made no difference (it always says A\B\Packages).

like image 700
Adam Greene Avatar asked Oct 28 '16 22:10

Adam Greene


People also ask

How do I fix NuGet recovery failed?

Quick solution for Visual Studio usersSelect the Tools > NuGet Package Manager > Package Manager Settings menu command. Set both options under Package Restore. Select OK. Build your project again.

How do I fix a missing NuGet package?

Restore NuGet packagesNavigate to Tools > Options > NuGet Package Manager > General, and then select the Allow NuGet to download missing packages check box under Package Restore. Enabling Restore NuGet Packages. In Solution Explorer, right-click the solution, and then select Restore NuGet Packages.

How do I clean and restore a NuGet package?

After you enable package restore in Options, you can right-click the solution in Solution Explorer and select Restore NuGet Packages to restore packages anytime. If you enabled automatic restore in Options, Package Restore happens automatically when you create a project from a template or build a project.

How do I refresh a NuGet package in Visual Studio?

In Tools -> Options -> NuGet Package Manager -> General you need to select the "Allow NuGet to download missing packages" option which allows NuGet to restore and the "Automatically check for missing packages during build in Visual Studio" which enables on build restore.


2 Answers

VisualStudio 2019: Tools > Nuget Package Manager > Package Sources:

Select nuget.org and specifically unselect the others options

like image 54
EmreOZTURK Avatar answered Sep 16 '22 12:09

EmreOZTURK


Add NuGet.org reference in the package source Go to tools -> NuGet package manager-> package manager settings Select NuGet Package manager and then Package sources Add the following source library.

Name: NuGet.org

Source: {"\Https://api.nuget.org/v3/index.json}

like image 25
user12011665 Avatar answered Sep 16 '22 12:09

user12011665