McArthey
McArthey

Reputation: 1646

'Microsoft.Rest.ClientRuntime' already has a dependency defined for 'Newtonsoft.Json'

Attempting to install a package via Nuget into VS2012 and am encountering the following error.

PM> install-package microsoft.rest.clientruntime
Attempting to resolve dependency 'Newtonsoft.Json (≥ 6.0.8)'.
Install-Package : 'Microsoft.Rest.ClientRuntime' already has a dependency defined for 'Newtonsoft.Json'.
At line:1 char:16
+ install-package <<<<  microsoft.rest.clientruntime
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

This issue is referenced in many locations, including here, but without exception the recommendation is to update to the latest version of Nuget.

I am running the latest version and have not been able to resolve this. Nuget Version: 2.8.60318.667

I also tried to create a brand new solution and install the same package with the same results so it definitely is related to Nuget and not the project.

Upvotes: 3

Views: 4222

Answers (3)

Adam Hems
Adam Hems

Reputation: 121

I had this problem using a NGet Package step in VSTS and creating the PowerShell step at this link fixed it:

https://github.com/Microsoft/vsts-tasks/issues/3756#issuecomment-288185011

Upvotes: 0

JConstantine
JConstantine

Reputation: 3931

I had this issue recently when creating a private nuget feed within Visual Studio Team Services.

It turns out that after removing a Nuget package it hadn't updated the packages.config correctly and there was an orphaned reference which wasn't part of the .csproj file.

Removing the reference did the trick!

Upvotes: 0

Matt Ward
Matt Ward

Reputation: 47967

The problem is that the version of NuGet you are using is too old. You need at least NuGet version 2.12.

Visual Studio 2012 does not support NuGet 2.12 which is required by the latest Microsoft.Rest.ClientRuntime since it has dependency groups that target .NETStandard which are unknown by older versions of NuGet and result in the already has a dependency defined for error.

So you would need to upgrade your Visual Studio version, or try using an older version of the Microsoft.Rest.ClientRuntime NuGet package, or not use NuGet and download the Microsoft.Rest.ClientRuntime NuGet package directly from nuget.org and extract the required assemblies.

Upvotes: 4

Related Questions