在 Windows 10 上开发通用应用程序时缺少 Live SDK 程序集引用

Live SDK assembly reference missing when developing Universal App on Windows 10

我正在使用 windows 10 SDK 开发应用程序,我想使用 Live SDK。我使用的是 VS 2015,我已经通过 nuget 安装了 Live SDK。

以下代码取自 MSDN 示例代码:

LiveConnectClient liveClient;
    private async Task<int> UploadFileToOneDrive()
    {
        try
        {
            //  create OneDrive auth client
            var authClient = new LiveAuthClient();

            //  ask for both read and write access to the OneDrive
            LiveLoginResult result = await authClient.LoginAsync(new string[] { "wl.skydrive", "wl.skydrive_update" });

            //  if login successful 
            if (result.Status == LiveConnectSessionStatus.Connected)
            {
                //  create a OneDrive client
                liveClient = new LiveConnectClient(result.Session);

                //  create a local file
                StorageFile file = await ApplicationData.Current.LocalFolder.CreateFileAsync("filename", CreationCollisionOption.ReplaceExisting);

                //  copy some txt to local file
                MemoryStream ms = new MemoryStream();
                DataContractSerializer serializer = new DataContractSerializer(typeof(string));
                serializer.WriteObject(ms, "Hello OneDrive World!!");

                using (Stream fileStream = await file.OpenStreamForWriteAsync())
                {
                    ms.Seek(0, SeekOrigin.Begin);
                    await ms.CopyToAsync(fileStream);
                    await fileStream.FlushAsync();
                }

                //  create a folder
                string folderID = await GetFolderID("folderone");

                if (string.IsNullOrEmpty(folderID))
                {
                    //  return error
                    return 0;
                }

                //  upload local file to OneDrive
                await liveClient.BackgroundUploadAsync(folderID, file.Name, file, OverwriteOption.Overwrite);

                return 1;
            }
        }
        catch
        {
        }
        //  return error
        return 0;
    }

    public async Task<int> DownloadFileFromOneDrive()
    {
        try
        {
            string fileID = string.Empty;

            //  get folder ID
            string folderID = await GetFolderID("folderone");

            if (string.IsNullOrEmpty(folderID))
            {
                return 0; // doesnt exists
            }

            //  get list of files in this folder
            LiveOperationResult loResults = await liveClient.GetAsync(folderID + "/files");
            List<object> folder = loResults.Result["data"] as List<object>;

            //  search for our file 
            foreach (object fileDetails in folder)
            {
                IDictionary<string, object> file = fileDetails as IDictionary<string, object>;
                if (string.Compare(file["name"].ToString(), "filename", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    //  found our file
                    fileID = file["id"].ToString();
                    break;
                }
            }

            if (string.IsNullOrEmpty(fileID))
            {
                //  file doesnt exists
                return 0;
            }

            //  create local file
            StorageFile localFile = await ApplicationData.Current.LocalFolder.CreateFileAsync("filename_from_onedrive", CreationCollisionOption.ReplaceExisting);

            //  download file from OneDrive
            await liveClient.BackgroundDownloadAsync(fileID + "/content", localFile);

            return 1;
        }
        catch
        {
        }
        return 0;
    }

问题是即使安装了 nuget,LiveConnectClient 也没有被识别。缺少其程序集引用。当我尝试通过添加引用手动设置它时,它仍然没有得到解决。 (难道只代表windows 8?)

Live SDK信息如下图所示:

Live SDK 来自这里:https://github.com/liveservices/LiveSDK-for-Windows

我在这里错过了什么?

这可能是 Nuget 包 的问题,因此 似乎解决了这个问题。您将在以下位置找到参考:

C:\Users\USER\.nuget\packages\LiveSDK.6.3\WindowsXAML\MicrosoftLive.dll