Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NuGet install-package doesn't work. How can I get more verbose information to help debug why this is failing?

A collegue is trying to install a nuget package into a simple default c# web application. It fails almost instantly.

Is there an argument I can provide to Install-Package <some nuget package> in the Visual Studio Package Manager Console to get some verbose information to help debug why the installation fails?

Error Message:

An error occurred while retrieving package metadata for '' from source 'MyGet'.

Info: Visual Studio: V2015 NuGet extension: 3.4.4.1321 Nuget package source: MyGet

Sample NuGet.config file found in the root directory of the solution:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="MyGet" value="https://www.myget.org/F/<our package>/api/v2" /> 
  </packageSources>
</configuration>

For myself, I can install the package fine. In fact, we have 5 packages in this MyGet public repo and I just installed 2 of the packages, just then .. when I test this out (again) before I created this SO question.

Anyone have a suggestion, please?

UPDATE

As stated above, this is using the PACKAGE MANAGER CONSOLE, not the CLI.

Using the -verbosity detailed in the PMC this is what happens..

PM> install-package xunit -verbosity detailed
Install-Package : A parameter cannot be found that matches parameter name 'verbosity'.
At line:1 char:23
+ install-package xunit -verbosity detailed
+                       ~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Install-Package], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
like image 626
Pure.Krome Avatar asked Jun 19 '16 01:06

Pure.Krome


People also ask

How do I force a NuGet package to reinstall?

Switch to the Browse tab, search for the package name, select it, then select Install). For all packages, delete the package folder, then run nuget install . For a single package, delete the package folder and use nuget install <id> to reinstall the same one.

How do I install NuGet packages missing?

Right-click the project, select Manage NuGet Packages, and use the NuGet Package Manager to uninstall and reinstall the affected packages. For more information, see Reinstall and update packages.

How do I resolve a 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 manually install a NuGet package?

Open your project or solution in Visual Studio, and select Tools > NuGet Package Manager > Package Manager Console to open the Package Manager Console window. In the console, enter Find-Package with a keyword to find the package you want to install.


1 Answers

You could try adding the -Verbose parameter to your PowerShell command.

 install-package xunit -verbose

You can also try looking at the $error object to see if that has more information, such as an exception callstack.

$error.Exception.StackTrace

The above may or may not give you more information.

like image 120
Matt Ward Avatar answered Oct 20 '22 00:10

Matt Ward