I am getting an error:
"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"}
running the following code:
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,
});
Any ideas on how to resolve this error?
I tried updating the install of the Http Client Libraries from Nuget according to this answer, but that failed to install with the error: Failed to add reference to System.Net.Http, please make sure it is in the global assembly cache. I don't know what the global assembly cache is, or how to make sure it is in there. Is there a solution to this problem?