问题描述
我正在尝试安装Newtonsoft Json(具有程序包管理器控制台),以便可以在C#控制台应用程序中使用它,但出现此错误:
I am trying to install Newtonsoft Json (with the package manager console) so that I can use it in my C# console app, but I get this error:
PM> Install-Package Newtonsoft.Json
Install-Package : Unable to find package 'Newtonsoft.Json'
At line:1 char:1
+ Install-Package Newtonsoft.Json
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
为什么会出现此错误?
推荐答案
我可能来晚了,但这通常是由错误的软件包来源引起的,不同的软件包来自不同的来源,例如angularJS.core软件包来自nuget.org来源,因此,如果您搜索它,并且已将Microsoft和.NET设置为来源,那么您将找不到它.
I might be just be late to answer, but this is usually caused by the incorrect package source, different packages come from different sources, for example angularJS.core packages comes from nuget.org source so if you search it and you have Microsoft and .NET set as your source, then you wont be able to find it.
要尝试回答您的问题,请在您的PM控制台上选择更改源(请参阅随附的屏幕截图),您可能还需要确保指向正确的项目(随附的屏幕快照也将在这方面指导您).甚至更好的是,在您的来源中选择全部",您应该会很好
To attempt to answer your question, please select the change the source on your your PM console(see attached screenshot) , you might also want to make sure that you point to the correct project(attached screenshot will also guide you on that regard). Or even better just select "All" on your source and you should be good
这篇关于无法安装Newtonsoft Json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!