问题描述
根据this article,可以使用代码通过Powershell安装MailKit库
Install-Package -Name 'MailKit' -Source 'nuget.org
'
我没有成功安装,这会产生以下错误消息:
Install-Package : No match was found for the specified search criteria and package name 'MailKit'. Try
Get-PackageSource to see all available registered package sources.
At line:1 char:1
+ Install-Package -Name 'MailKit' -Source 'nuget.org'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package],Ex
ception
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
我一直在寻找解决方案,但没有成功。当我尝试添加Verbose
参数时,输出如下:
VERBOSE: Using the provider 'NuGet' for searching packages.
VERBOSE: Searching repository 'https://api.nuget.org/v3/index.json/FindPackagesById()?id='MailKit'' for ''.
任何帮助将不胜感激。
解决方法
遵循this question的建议后,我能够安装MailKit。我必须将NuGet源从v3更改为v2,以使其到达返回“ Dependency loop”错误的地步。要安装,我跑了
Install-Package -Name "MailKit" -Source nuget.org -SkipDependencies
我认为这是一个快速而肮脏的修复程序,而不是实际问题的解决方案,因为我还必须单独安装依赖项 MimeKit 。