2017-11-10 7 views
0

다음과 같이 API V3를 통해 Google 드라이브에 파일을 업로드하는 프로그램의 출시시이 사실을 알 수 없습니다.Google 드라이브 API로 인한 System.Net.Http 또는 종속성이 누락되었습니다.

FileNotFoundException이를 : : 던져 파일 또는 어셈블리 로드 할 수 없습니다 ', System.Net.Http을 버전 = 4.0.0.0, 문화 = 중립, PublicKeyToken = b03f5f7f11d50a3a'또는 해당 종속성 중 하나. 시스템에서 지정된 파일을 찾을 수 없습니다.

이것은 디버그 모드가 아니라 릴리스 모드와 게시 된 버전에서 발생합니다. 내가 제거한 다음 업데이트 한 다음 프로젝트에 대한 system.Net.Http 참조를 다시 추가했습니다. Google API를 업데이트했으며 많은 설정과 참조를 사용하지 않도록 변경했습니다.

무엇이 빠졌는지 또는 어떻게 대체 할 것인지 잘 모르겠습니다. 나는 그것이 업로드 클래스의 연결 메소드를 호출 할 때 발생한다는 것을 알고 있지만, 코드가이 메소드를 종료 한 후에 예외가 발생합니다.

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, 
       }); 

      } 
} 
} 

무엇이 프로그램을 어셈블리를 찾을 수 없게 만들 수 있습니까?

+1

[SO 게시물] (https://stackoverflow.com/questions/20463119/the-system-cannot-find-the-file-specified)을 방문하셨습니까? 아마도이 오류를 제거하는 데 도움이 될 수 있습니다. –

답변

1

내 프로젝트에서 정확히 같은 오류가 발생했습니다. 나는 릴리스 이후 System.Net.Http.dll이 .exe가있는 폴더에 없다는 것을 알았습니다. bin \ Debug-folder에서 복사하여 도움이되는지보십시오. 인사말.

+0

이것은 핵심이었고, 이제 릴리스 빌드에서 작동합니다. 이제 게시 된 oneclick 앱에 포함하는 방법을 알아 내야합니다. –