C# 通用Windows类库中的异步调用

C# 通用Windows类库中的异步调用,c#,uwp,win-universal-app,class-library,C#,Uwp,Win Universal App,Class Library,我有一个通用Windows类库,我想在其中调用一些异步方法,如: await Launcher.LaunchUriAsync(new Uri( "ms-windows-store://review/?PFN=" + Package.Current.Id.FamilyName)); “IAsyncOperation”不包含“GetAwaiter”的定义 并且没有扩展方法“GetAwaiter”接受 找不到类型“IAsyncOperation”(是否缺少使用 “系统”指令?) 当然,我的u

我有一个通用Windows类库,我想在其中调用一些异步方法,如:

await Launcher.LaunchUriAsync(new Uri(
    "ms-windows-store://review/?PFN=" + Package.Current.Id.FamilyName));
“IAsyncOperation”不包含“GetAwaiter”的定义 并且没有扩展方法“GetAwaiter”接受 找不到类型“IAsyncOperation”(是否缺少使用 “系统”指令?)

当然,我的using语句中有一个系统:

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项目模板的问题。

根据,您可以尝试重建NuGet缓存。您是如何添加库的(您选择了哪一个作为新项目)?不应该有像Universal.Windows和Microsoft.NETCore这样的引用吗?@Romasz我在VS2017 RC中添加了一个新的visualc#->Windows Universal->类库(universalwindows),但是默认情况下没有添加任何引用。我还手动添加了“Microsoft.NETCore.Portable.Compatibility”:“1.0.2”。@Yarik清除nuget缓存不幸没有帮助。