通用 Windows Class 库中的异步调用
Async-Call in Universal Windows Class Library
我有一个通用WindowsClass库,我想在其中调用一些异步方法,例如:
await Launcher.LaunchUriAsync(new Uri(
"ms-windows-store://review/?PFN=" + Package.Current.Id.FamilyName));
'IAsyncOperation' does not contain a definition for 'GetAwaiter'
and no extension method 'GetAwaiter' accepting a first argument of
type 'IAsyncOperation' could be found (are you missing a using
directive for 'System'?)
当然我的 using 语句中有 System:
using System;
using System.Threading.Tasks;
using Windows.System;
using Windows.ApplicationModel;
我怀疑我在 project.json 中缺少引用,因为目前唯一的依赖项是
"Microsoft.NETCore.Portable.Compatibility": "1.0.2"
我是否遗漏了一个依赖项或者这是一个不同的问题?
正如我所怀疑的那样,我缺少一个 nuget 包,即 Microsoft.NETCore.UniversalWindowsPlatform
。
这似乎是 Visual Studio 2017 RC 项目模板的问题。
我有一个通用WindowsClass库,我想在其中调用一些异步方法,例如:
await Launcher.LaunchUriAsync(new Uri(
"ms-windows-store://review/?PFN=" + Package.Current.Id.FamilyName));
'IAsyncOperation' does not contain a definition for 'GetAwaiter' and no extension method 'GetAwaiter' accepting a first argument of type 'IAsyncOperation' could be found (are you missing a using directive for 'System'?)
当然我的 using 语句中有 System:
using System;
using System.Threading.Tasks;
using Windows.System;
using Windows.ApplicationModel;
我怀疑我在 project.json 中缺少引用,因为目前唯一的依赖项是
"Microsoft.NETCore.Portable.Compatibility": "1.0.2"
我是否遗漏了一个依赖项或者这是一个不同的问题?
正如我所怀疑的那样,我缺少一个 nuget 包,即 Microsoft.NETCore.UniversalWindowsPlatform
。
这似乎是 Visual Studio 2017 RC 项目模板的问题。