I am trying to download a file from google drive using C# .net. I am using the example code from https://developers.google.com/drive/web/manage-downloads
The code does not compile and giving definition error for IAuthenticator
error CS0234: The type or namespace name 'Authentication' does not exist in the namespace 'Google.Apis' (are you missing an assembly reference?)
error CS0246: The type or namespace name 'IAuthenticator' could not be found (are you missing a using directive or an assembly reference?)
using Google.Apis.Auth.OAuth2;
using Google.Apis.Drive.v2;
using Google.Apis.Drive.v2.Data;
using Google.Apis.Services;
using Google.Apis.Authentication;
public static System.IO.Stream DownloadFile(
IAuthenticator authenticator, File file) {
I also tried
service.Files.Get(fileId).Download(myFileStream);
However this is giving error on "file already used by process"
Has anyone successfully used the C# example to download file?
PS: I have installed required nuget pacakages
PM> install-package Google.Apis.Auth
Attempting to resolve dependency 'Google.Apis.Core (≥ 1.9.0)'.
Attempting to resolve dependency 'Microsoft.Bcl (≥ 1.1.9)'.
Attempting to resolve dependency 'Microsoft.Bcl.Build (≥ 1.0.14)'.
Attempting to resolve dependency 'Microsoft.Bcl.Async (≥ 1.0.168)'.
Attempting to resolve dependency 'Microsoft.Net.Http (≥ 2.2.22)'.
Attempting to resolve dependency 'Newtonsoft.Json (≥ 6.0.4)'.
'Google.Apis.Auth 1.9.0' already installed.
GoogleDrive already has a reference to 'Google.Apis.Auth 1.9.0'.