I cannot figure this one out, on a release of a program that uploads a file to Google Drive through V3 of the API, an exception, as follows, is throw:
FileNotFoundException: Could not load file or assembly 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
This does not happen in debug mode but in release mode and published versions. I have removed, then updated, then re added the system.Net.Http references to the project. I have updated the Google API, and have changed a number of settings and references to no avail.
I have no idea what is missing or how to replace it. I know it happens when I call the connection method of the uploading class, but the exception is thrown after the code exits this method.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.Net.Http;
using Google.Apis.Auth.OAuth2;
using Google.Apis.Drive.v3;
using Google.Apis.Drive.v3.Data;
using Google.Apis.Services;
using Google.Apis.Util.Store;
using System.IO;
using System.Threading;
//using Google.Apis.Vision.v1;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace Rohl
{
public class DriveManager
{
static string[] Scopes = { DriveService.Scope.Drive};
static string ApplicationName = "Rohl - Drive Services";
UserCredential credential;
public void connector()
{
using (var stream = new FileStream("client_secret.json", FileMode.Open, FileAccess.Read))
{
string credPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
credPath = Path.Combine(credPath, ".credentials/drive-dotnet-quickstart.json");
credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
Scopes,
"user",
CancellationToken.None,
new FileDataStore(credPath, true)).Result;
Properties.Settings.Default.DebugWrite.Add(DateTime.Now.ToString("hh.mm.ss.ff") + " CREDENTIALS SAVED TO - " + credPath);
}
service = new DriveService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = ApplicationName,
});
}
}
}
What am I missing that could cause the program to not be able to find the assembly?