I am trying to fetch calendar information for Google calender with C# .net 4.0. If i make a new Windows Form Application and then using NuGet to download Google Calendar API V3, all dependency is installed and everything works as it should. Now to my real problem, i am not actually making a Form Application (that was just a test to verify the function) i am making a class library that is loaded from another application, you can call it a plugin for that program. I have made several plugins before but i have never had any issues like this before. When i try to run the code i get this error message:
An exception of type 'System.IO.FileNotFoundException' occurred in GOOGLE.APIS.CORE.dll but was not handled in user code
Additional information: Could not load file or assembly 'System.Net.Http.Primitives, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
I don't know where it gets the information to try to load version 1.5.0.0 and also why it cant manage to load the correct .dll, iam using the exact same code that is working in my Form Application. And the same files is installed with NuGet.
I don't know how i could debug this more, anyone that have been in the same situation and know how to solve this?
iam using Google Calendar API V3 Client Library version 1.9.0.1130
I have investigating this some more and i could get the same error on my Form Application if i delete the app.config file. Maybe the problem in my class library is that my .config is not loading. Is there a way to verify this?
I have made som progress. I am not the developer of the application that is loading my .dll so i could not change anything in the load process but i noticed that the applications .exe file did not have any .config file, i created a file BMTool.exe.config and the i added the information that was autogenerated in my app.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.22.0" newVersion="2.2.22.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.22.0" newVersion="2.2.22.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
And now it works as it should, so now my question is it possible for me to handle this inside my code and not have to modify the files of the application that is loading my .dll?