question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Installing System.Net.Http using Install-Package fails with "Dependency loop detected for package"

See original GitHub issue

I am installing packages to a folder using the following pwsh commands:

Register-PackageSource -Location https://www.nuget.org/api/v2 -Name Nuget -ProviderName Nuget -Trusted -force

Install-Package -Name System.Net.Http -ProviderName Nuget -Destination $somedir

It fails with:

Install-Package : Dependency loop detected for package 'System.Net.Http'.
At C:\git\mobiltracker-ps-docker\Publish-PackageDll.ps1:81 char:1
+ Install-Package -Name $Name -ProviderName Nuget -Destination $Source  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : Deadlock detected: (System.Net.Http:String) [Install-Package], Exception
+ FullyQualifiedErrorId : DependencyLoopDetected,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

It looks like the offending package is System.Diagnostics.DiagnosticSource v4.6.0

Workaround:

Installing in the current order works:

  1. Install-Package System.Diagnostics.DiagnosticSource -RequiredVersion 4.5.1 -Provider nuget
  2. Install-Package System.Net.Http -Provider nuget
  3. Install-Package System.Diagnostics.DiagnosticSource -Provider nuget

I opened an issue (https://github.com/dotnet/corefx/issues/41532) on dotnet core repo, but it seems to be related to this client cmdlets.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:8
  • Comments:8

github_iconTop GitHub Comments

1reaction
MartinHBAcommented, Nov 19, 2019

@urbantom it’s PowerShell implementation of Nuget provider, it’s just awful. It works only with packages without dependencies (or maybe simple dependencies). You can install package with skip dependencies parameter, but you might lose some functionality which is sad. Nuget+PowerShell is total lame. See my gist example and compare

1reaction
nvarscarcommented, Oct 7, 2019

I’m seeing the same behaviour with two unrelated packages on Powershell 6.2.5 running on an Ubuntu machine in Appveyor. Here’s some details I was able to capture:

Exception                     : System.Exception: Dependency loop detected for package 'Npgsql'.
TargetObject                  : Npgsql
FullyQualifiedErrorId         : DependencyLoopDetected,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
InvocationInfo                : System.Management.Automation.InvocationInfo
ErrorCategory_Category        : 4
ErrorCategory_Activity        : Install-Package
ErrorCategory_Reason          : Exception
ErrorCategory_TargetName      : Npgsql
ErrorCategory_Message         : Deadlock detected: (Npgsql:String) [Install-Package], Exception
Read more comments on GitHub >

github_iconTop Results From Across the Web

Dependency loop detected for package 'Microsoft.Data. ...
First I Install the latest Nuget provider running following command in an elevated PowerShell prompt: Install-PackageProvider Nuget –force – ...
Read more >
Install-Package : Dependency loop detected for ...
Hi, I'm having a rough time trying to install SQL SMO to a server. This is my first time trying Nuget. Previously I...
Read more >
NuGet Package Management with PowerShell
I can check if I have NuGet as a Package source using Get-PackageSource ... Install-Package : Dependency loop detected for package 'Azure.
Read more >
Install-Package (NuGet) giving a "Deadlock detected" error
Yesterday I created a new virtual machine using… ... Install-Package : Dependency loop detected for package 'SSH.NET'.
Read more >
Dependency loop detected for package 'Microsoft.Data.Sqlite'
I am trying to install Microsoft.Data.Sqlite with PowerShell's cmdLet install-package : $pkg = find-package -name Microsoft.Data.Sqlite install-package ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found