相关疑难解决方法(0)

Windows 服务中的 IAsyncOperation 等待:“类型在未引用的程序集中定义...”

我有一个 Windows 服务(使用本教程创建)。

我正在尝试运行IAsyncOperation

var uri= new Uri(@"uri/to/second/app");
var options = new LauncherOptions
{
   TargetApplicationPackageFamilyName = "second-app-guid"
};
var results = await Launcher.LaunchUriForResultsAsync(uri, options);
Run Code Online (Sandbox Code Playgroud)

但是,我从以下错误中得到以下错误await

  • The type 'IAsyncOperationWithProgress<,>' is defined in an assembly that is not referenced. You must add a reference to assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'.
  • The type 'IAsyncOperation<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'.
  • The …

.net windows-services async-await windows-runtime windows-10-desktop

6
推荐指数
1
解决办法
5015
查看次数