title: DropBox API throws FileNotFoundException
body: <p>I'm playing around with .NET Core and i found myself in a bit of a pickle. I have an app (ASP.NET Core Web Application) which makes a call to search for some files in my Dropbox account. The call is made through a bunch of layers (different .net core class library projects) eventually reaching the final project which has a reference to Dropbox 3.4.1 API which makes the actual call to Dropbox.</p>
  
  <p>The problem is that the bellow exception is thrown. Interesting tho, making the exact same call from a .Net Core Console Application works just fine.</p>
  
  <p>Here is the project.json of the Web Application: </p>
  
  <pre><code>{
    "dependencies": {
      "Microsoft.NETCore.App": {
        "version": "1.0.0",
        "type": "platform"
      },
      "System.Runtime.Serialization.Primitives": "4.1.1",
      "Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
      "Microsoft.AspNetCore.Diagnostics": "1.0.0",
      "Microsoft.AspNetCore.Mvc": "1.0.0",
      "Microsoft.AspNetCore.Razor.Tools": {
        "version": "1.0.0-preview2-final",
        "type": "build"
      },
      "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
      "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
      "Microsoft.AspNetCore.StaticFiles": "1.0.0",
      "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
      "Microsoft.Extensions.Configuration.Json": "1.0.0",
      "Microsoft.Extensions.Logging": "1.0.0",
      "Microsoft.Extensions.Logging.Console": "1.0.0",
      "Microsoft.Extensions.Logging.Debug": "1.0.0",
      "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
      "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
      "SyncPlayer.Common": "1.0.0-*",
      "SyncPlayer.Domain": "1.0.0-*"
    },
  
    "tools": {
      "BundlerMinifier.Core": "2.0.238",
      "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
      "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
    },
  
    "frameworks": {
      "netcoreapp1.0": {
        "imports": [
          "dotnet5.6",
          "portable-net45+win8"
        ]
      }
    },
  
    "buildOptions": {
      "emitEntryPoint": true,
      "preserveCompilationContext": true
    },
  
    "runtimeOptions": {
      "configProperties": {
        "System.GC.Server": true
      }
    },
  
    "publishOptions": {
      "include": [
        "wwwroot",
        "Views",
        "Areas/**/Views",
        "appsettings.json",
        "web.config"
      ]
    },
  
    "scripts": {
      "prepublish": [ "bower install", "dotnet bundle" ],
      "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
    }
  }
  </code></pre>
  
  <p>The project.json of the Console Application:</p>
  
  <pre><code>{
    "version": "1.0.0-*",
    "buildOptions": {
      "emitEntryPoint": true
    },
  
    "dependencies": {
      "Microsoft.NETCore.App": {
        "type": "platform",
        "version": "1.0.0"
      },
      "SyncPlayer.Common": "1.0.0-*",
      "SyncPlayer.Domain": "1.0.0-*",
      "SyncPlayer.Dropbox": "1.0.0-*",
      "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24027"
    },
  
    "frameworks": {
      "netcoreapp1.0": {
        "imports": "dnxcore50"
      }
    }
  }
  </code></pre>
  
  <p>And the StackTrace of the exception thrown:</p>
  
  <blockquote>
    <p>System.IO.FileNotFoundException: Could not load file or assembly 'System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'. The system cannot find the file specified.
    File name: 'System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'
      at Dropbox.Api.Files.SearchArg..ctor(String path, String query, UInt64 start, UInt64 maxResults, SearchMode mode)
      at Dropbox.Api.Files.Routes.FilesRoutes.SearchAsync(String path, String query, UInt64 start, UInt64 maxResults, SearchMode mode)
      at SyncPlayer.Dropbox.DropboxClientWrapper.d__4.MoveNext() in E:\Projects\SyncPlayer.Core\SyncPlayer\SyncPlayer.Dropbox\DropboxClientWrapper.cs:line 47
    --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter<code>1.GetResult()
      at SyncPlayer.Dropbox.DropboxDataStore.&lt;SearchAsync&gt;d__3.MoveNext() in E:\Projects\SyncPlayer.Core\SyncPlayer\SyncPlayer.Dropbox\DropboxDataStore.cs:line 27
    --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter</code>1.GetResult()
      at SyncPlayer.Dropbox.Services.DropboxFileFinderService.d__4.MoveNext() in E:\Projects\SyncPlayer.Core\SyncPlayer\SyncPlayer.Dropbox\Services\DropboxFileFinderService.cs:line 28
    --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter<code>1.GetResult()
      at SyncPlayer.Domain.FileFinderFacade.&lt;FindAudioFileAsync&gt;d__5.MoveNext() in E:\Projects\SyncPlayer.Core\SyncPlayer\SyncPlayer.Domain\FileFinderFacade.cs:line 27
    --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter</code>1.GetResult()
      at SyncPlayer.SPA.Controllers.HomeController.d__2.MoveNext() in E:\Projects\SyncPlayer.Core\SyncPlayer\SyncPlayer.SPA\Controllers\HomeController.cs:line 18</p>
  </blockquote>
  
  <p>I'm probably missing some configuration on the web app, any ideas ?!</p>