'Microsoft.Rest.ClientRuntime' already has a dependency defined for 'Newtonsoft.Json' - visual-studio-2012

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.

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.

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!

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

Related

Problem with NuGet package lacking compatible references or files - and its simple solution

Trying to install a package called BarcodeLib from the NuGet Package manager, but it fails with the following message:
Could not install package 'BarcodeLib 2.2.1'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
From the console:
PM> Install-Package BarcodeLib -Version 2.2.1
Attempting to gather dependency information for package 'BarcodeLib.2.2.1' with respect to project 'XXX', targeting '.NETFramework,Version=v4.5'
Gathering dependency information took 498,07 ms
Attempting to resolve dependencies for package 'BarcodeLib.2.2.1' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'BarcodeLib.2.2.1'
Resolved actions to install package 'BarcodeLib.2.2.1'
Retrieving package 'BarcodeLib 2.2.1' from 'nuget.org'.
Install failed. Rolling back...
Package 'BarcodeLib.2.2.1' does not exist in project 'XXX'
Package 'BarcodeLib.2.2.1' does not exist in folder 'C:\Projects\SVN\trunk\etc'
Executing nuget actions took 15,28 ms
Install-Package : Could not install package 'BarcodeLib 2.2.1'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package BarcodeLib -Version 2.2.1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Time Elapsed: 00:00:00.5761964
Since the error message indicated that the package did not contain any files targeting .NetFrameWork 4.5, I tried to lower the framework version of my project... but that didn't help.
Answering my own question:
It was not the package that was built with an older version of .NET framework. Instead it was me who hadn't got the latest dotnet framework version, that the package required.
I found this out from downloading the project and trying to open it:
The simple solution was to upgrade Visual Studio 2017 to its latest version. Either by following the link in the messagebox (Download targeting pack for v4.6.2).
Most likely there is also a hidden notification about an update in Visual Studio. Show it by writing "Notifications" in quick launch textbox in the upper right corner of Visual Studio 2017, and then choose to automatically install the updates available:

Can't install umbraco using nuget "operation failed"

i'am new use umbraco cms after i try to install using nuget in visual studio 2012 i get this error
From nuget package
'Newtonsoft.Json' already has a dependency defined for 'Microsoft.CSharp'.
and this from nuget console
Install-Package : 'Newtonsoft.Json' already has a dependency defined for 'Microsoft.CSharp'.
At line:1 char:1
+ Install-Package UmbracoCms
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
how to solve this
I had this yesterday. You need to make sure your NuGet manager in Visual Studio is the latest version. On older versions, you'll get that error. Upgrading the NuGet manager fixed the error for me. See here for some more info: http://issues.umbraco.org/issue/U4-9848

Nuget update-package error with Microsoft.ApplicationInsights.JavaScript

Wether I start a new project and add Azure Application Insights or add Insights to an existing project, it seems to break my Nuget updates.
Attempting to resolve dependencies for multiple packages
update-package : Unable to find package 'Microsoft.ApplicationInsights.JavaScript'. Existing packages must be restored before
performing an install or update.
At line:1 char:1
+ update-package
+ ~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Update-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.UpdatePackageCommand
I can no longer just type 'update-package' to update all my packages.
Using VS2015
How do I fix this?
Do you have the "Include Prerelease" option checked in the NuGet package manager (or specify -IncludePrerelease in the Update-Package command in the Package Manager Console)?
I believe the JavaScript package is only pre-release at this moment.

Installing Caliburn.Micro NuGet Package always fails

I am attempting to compile the Caliburn.Micro projects from GitHub so I can generate the DLL's to use in my own project - a Caliburn.Micro Xamarin Native Android project.
I have loaded the Caliburn.Micro.sln (located in the src folder) into Visual Studio 2012 professional and attempted to build the Caliburn.Micro project. I get 40 errors relating to metadata. For example;
Error 5 Metadata file '_Tests\Caliburn.Micro-xamarin\Caliburn.Micro-xamarin\bin\net45\Debug\Caliburn.Micro.Platform.dll' could not be found _Tests\Caliburn.Micro-xamarin\Caliburn.Micro-xamarin\src\Caliburn.Micro.Tests.NET45\CSC Caliburn.Micro.Tests.NET45
So I have attempted to install the Caliburn.Micro NuGet package on this project and I get the following errors. I have also created my own new solution and attempted to install the Caliburn.Micro NuGet package and the same error occurs.
Any ideas what is going wrong?
PM> Install-Package Caliburn.Micro
Attempting to resolve dependency 'Caliburn.Micro.Core (= 2.0.2)'.
Installing 'Caliburn.Micro.Core 2.0.2'.
Successfully installed 'Caliburn.Micro.Core 2.0.2'.
Installing 'Caliburn.Micro 2.0.2'.
Successfully installed 'Caliburn.Micro 2.0.2'.
Adding 'Caliburn.Micro.Core 2.0.2' to Caliburn.Micro.
Uninstalling 'Caliburn.Micro.Core 2.0.2'.
Successfully uninstalled 'Caliburn.Micro.Core 2.0.2'.
Install failed. Rolling back...
Install-Package : Specified argument was out of the range of valid values.
Parameter name: supportedFrameworks
At line:1 char:1
+ Install-Package Caliburn.Micro
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], ArgumentOutOfRangeException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
The ArgumentOutOfRangeException with the argument name being supportedFrameworks usually means there is something wrong with one or more of your Portable Class Library (PCL) profiles.
NuGet looks at the .xml files in various PCL directories, for example:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile\Profile259\SupportedFrameworks
If for some reason NuGet does not find any non-Xamarin profile xml files in one of these directories it will throw an ArgumentOutOfRangeException. The SupportedFrameworks directory will either be empty or may just have Xamarin .xml files in there, both of these problems will cause the ArgumentOutOfRangeException.
To find which PCL profile has missing .xml files you can either look at every PCL profile directory or debug NuGet.
I usually use a console app that uses NuGet but you can easily debug, passing it the list command line argument which will trigger the same code path as NuGet version 2. If you then put a breakpoint on the line of code that throws the ArgumentOutOfRangeException you should be able to see which PCL profile is causing a problem.

Unable to find package 'WPtoolkit'

I want to install the Windows Phone Toolkit, following instructions from the Codeplex, but I keep getting the following error message in the Package Manager Console:
Install-Package : Unable to find package 'WPtoolkit'.
At line:1 char:1
+ Install-Package WPtoolkit
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
I also tried to look in "Manage NuGet Packages" and I couldn't find the Toolkit in the online tab there either.
Context: I've tried in VS2012 and VS2013, tried building as a WP8 and WP8.1 app.
I need this Toolkit because of the view components in there like the ListPicker and LongListMultiSelector.
Thanks in advance.
See if you have any updates available for Nuget Package Manager in the Notifications in the Notifications panel. If so try updating the package manager and try to re install WPToolkit.
I somehow managed to download the WPToolkit. I don't know which step fixed it but this is what I did:
Opened VS2013. Before opening any project, went to Tools > Extensions and Updates.
Under "Installed" tab I found the NuGet Package Manager for Visual Studio 2013, and uninstalled it.
Went to "Online" tab and installed it again.
Opened up my project.
Went to Tools > NuGet Package Manager > Manage NuGet Packages for Solution.
Searched in "Online" tab for "WPtoolkit" and found it!
I don't know if this helps anyone else but it may have been a bug in VS.

Resources