Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuget.exe Install — Microsoft.CSharp already has a dependency for System.Dynamic.Runtime

We install some packages via a PowerShell pre-build script in our CI build. Recently, we're been receiving Partially Successful email notifications with the following information provided:

'Microsoft.CSharp' already has a dependency defined for 'System.Dynamic.Runtime'

Here is the command from the PowerShell script that generates the information:

cd $source\MyNet\MyWeb\MyComp.WebViewer\packages
&"C:\Program Files\Microsoft Team Foundation Server 14.0\Tools\Nuget.exe" install newtonsoft.json

I would like to be able to handle/ignore this message so that fully Successful build notifications are received.

It doesn't seem to be causing any problems otherwise.

Does anyone have any nuget.exe command line parameters that might bypass such an error?

like image 621
mawa316 Avatar asked Jul 05 '16 21:07

mawa316


People also ask

What is NuGet package in C#?

Put simply, a NuGet package is a single ZIP file with the . nupkg extension that contains compiled code (DLLs), other files related to that code, and a descriptive manifest that includes information like the package's version number.

How do I add a NuGet package to Visual Studio 2010?

From Visual Studio, select Tools > NuGet Package Manager > Package Manager Console. After the Package Manager Console pane opens, verify that the Default project drop-down list shows the project in which you want to install the package. If you have a single project in the solution, it's preselected.

What is the .NuGet folder?

The global-packages folder is where NuGet installs any downloaded package. Each package is fully expanded into a subfolder that matches the package identifier and version number. Projects using the PackageReference format always use packages directly from this folder.


2 Answers

The error message already has a dependency defined for usually indicates that the version of NuGet you are using is too old. So you should look at updating it.

This particular error can happen when the NuGet packages being used are using a group dependency with a target framework which the version of NuGet you are using does not know about.

like image 103
Matt Ward Avatar answered Oct 15 '22 02:10

Matt Ward


In my case, I get a message when install some Nuget Package:

'PackageA' already has a dependency defined for 'PackageB'

.

And I search PackageB in Nuget Package Manager online, and click install button to install it again, then ran into a problem:

The package requires NuGet client version '2.12' or above, but the current NuGet version is '2.7.40911.287'.

and I do as this solution Nuget version not correct?

after I upgrade the version of Nuget Package Manager, I can install PackageB, and then I can install PackageA.

like image 1
yu yang Jian Avatar answered Oct 15 '22 00:10

yu yang Jian