gpt4 book ai didi

c# - Nuget 错误 : Failed to add reference to System.Net.Http

转载 作者:太空宇宙 更新时间:2023-11-03 19:59:09 25 4
gpt4 key购买 nike

我收到一个错误:

"Could not load file or assembly 'System.Net.Http.Primitives, Version=4.2.22.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.":"System.Net.Http.Primitives, Version=4.2.22.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"}

运行以下代码:

        base.Initialize(name, config);
_emailAddress = Settings.EmailAddress;
string clientSecret = Settings.ClientSecret;
string clientId = Settings.ClientId;
Task<UserCredential> tCredential;
ClientSecrets clientSecrets = new ClientSecrets {ClientId = clientId, ClientSecret = clientSecret};
tCredential = GoogleWebAuthorizationBroker.AuthorizeAsync(
clientSecrets,
Scopes,
"user",
CancellationToken.None);
UserCredential credential;
try
{
credential = tCredential.Result;
}
catch (Exception ex)
{
throw;
}
_service = new GmailService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "Draft Sender", //applicationName,
});

关于如何解决此错误的任何想法?

我尝试根据 this answer 从 Nuget 更新 Http 客户端库的安装,但安装失败并出现错误:无法添加对 System.Net.Http 的引用,请确保它位于全局程序集缓存中。我不知道全局程序集缓存是什么,或者如何确保它在那里。这个问题有解决办法吗?

最佳答案

尝试通过转到工具 -> 扩展和更新 -> 更新 -> NuGet 包管理器 -> 更新来更新你的 NuGet 包管理器。

然后卸载包再安装。

关于c# - Nuget 错误 : Failed to add reference to System.Net.Http,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30248701/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com