I have a Windows Service (created using this tutorial).
And I am trying to run an IAsyncOperation
:
var uri= new Uri(@"uri/to/second/app");
var options = new LauncherOptions
{
TargetApplicationPackageFamilyName = "second-app-guid"
};
var results = await Launcher.LaunchUriForResultsAsync(uri, options);
However, I get the following error from the 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'.
I have looked this error up and a lot of people said that it is due to a VS installation error but, performing a clean install (whilst checking the checksums of the ISOs) failed to solve the problem.
Also, I tried this in a blank Universal Windows App and this error didn't appear. So I wonder if this is even possible in a Windows Service? (.NET Framework version 4.6.1)