我有一个 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);
但是,我从以下错误中得到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 type 'IAsyncActionWithProgress<>' 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 'IAsyncAction' 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'.
我查看了这个错误,很多人说这是由于 VS 安装错误,但是执行全新安装(同时检查 ISO 的校验和)未能解决问题。
另外,我在一个空白的通用 Windows 应用程序中尝试了这个,并且没有出现这个错误。所以我想知道这是否可能在 Windows 服务中实现?(.NET 框架版本 4.6.1)