0

I fail when trying to use the Google API v3 in a user control.

Steps:

  • Create a new project in Visual Studio Express 2013 Update 4. Target framework: .NET 4.5 (tried 4.0 too)
  • Install NuGet package "Google.Apis.Calendar.v3 Client Library" and all and all dependencies
  • Add new User Control "MyControl"
  • In MyCalendar_Load add the following line: CalendarService service = new ServiceCalendar();
  • Add using Google.Apis.Calendar.v3;

So the code of my control looks like:

using System;
using System.Windows.Forms;
using Google.Apis.Calendar.v3;



namespace Google_Calendar_Test
{
    public partial class MyCalendar : UserControl
    {
        public MyCalendar()
        {
            InitializeComponent();
        }

        private void MyCalendar_Load(object sender, EventArgs e)
        {
            CalendarService service = new CalendarService();
        }
    }
}

Then I compile my solution so I get my newly created MyControl. When I try to put the control on the form the following error message appears:

enter image description here

System.IO.FileNotFoundException / Could not load file or assembly Google.Apis,

In the form I can add the CalendarService and start it without any problems. I'm puzzled.

Update

The version in the error message (V 1.0.0.23042) doesn't match to the version NuGet installed (V 1.0.0.26011). But this doesn't make any sense to me.

flexo
  • 1,120
  • 1
  • 9
  • 14
  • 1
    Maybe setting "Copy Locally" for the Google* assemblies to `true` does help? – Uwe Keim Dec 05 '14 at 07:44
  • Agreed try setting the Dlls to Copy Local or add them to GAC – Linda Lawton - DaImTo Dec 05 '14 at 07:46
  • Copy Locally is set for all Google* assemblies, I checked it. (this is set by default anyway). Zlib.Portable isn't set to true, changed it, but it doesn't solved the problem. – flexo Dec 05 '14 at 07:49
  • I just tested your code and it does compile. It doesn't do anything since you haven't added authentication yet. But there are no errors. all you need to do is Install-Package Google.Apis.Calendar.v3 That will get you everything you need – Linda Lawton - DaImTo Dec 05 '14 at 08:19
  • @DalmTo: yes, as I wrote I can compile the solution. But I can't add the control to my form. Then I get the error. This is a simple example to reproduce. In my 'real' project I have the authentication implemented with the JSON file and it does work (ready calendars and more) but not in is user control. – flexo Dec 05 '14 at 09:03

0 Answers0