I ran into this problem when I released my code that uses Google.Apis.Drive.v2 (v1.9.2.1860) for the company I work for. I gave them exe and all the DLLs created by Visual Studio (and NuGet) and they got an error. I never got an error.
It was easy to fix (as soon as I understood): when installing api from Nuget, the file "assemblyname.exe.config" is automatically created in the output folder (aka, Debug or Release). All you have to do is include this file when you run the assembly somewhere other than the folder in which it was generated. Here is the code for this file for me:
<?xml version="1.0" encoding="utf-8"?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> </startup> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.2.29.0" newVersion="4.2.29.0" /> </dependentAssembly> </assemblyBinding> </runtime> </configuration>
This is basically a βsecondβ fix, but it is automatically generated by the package manager. The problem for me was when I tried its βfirstβ fix, updating it to Google.Apis.Auth and Google.Apis.Core (v1.9.3), which exacerbated the situation. I would get the same error, except that now there was an incorrect version for "Google.Apis.Core" (although it probably could also be resolved by including the same .exe.config file.)
Hope this helps someone, I know this thread is pretty old, but this is the one that Google quick search led me to.
Edit: forgot to mention, this applies to a console application designed for .NET 4.5. Some of them are probably still relevant for other .NET or ASP.NET purposes, but I donβt know for sure. Your mileage may vary.
pittofdirk Sep 24 '15 at 15:25 2015-09-24 15:25
source share