4

This line

StorageFile photo = await cameraUI.CaptureFileAsync(CameraCaptureUIMode.Photo);

gives me this error:

Error CS0012
The type 'IAsyncOperation<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'Windows.Foundation.FoundationContract, Version=3.0.0.0, Culture=neutral,

How to fix it?

screenshot

8
  • Perhaps you need to add a reference to "Windows.Foundation.FoundationContract" library, which was explained here: stackoverflow.com/a/50959930/4329813 Commented Mar 30, 2019 at 8:49
  • 1
    Look at the Important notice here Commented Apr 3, 2019 at 7:31
  • @jsanalytics Thanks, man. Good catch! Anyway I am wondering to use async/await in this type of DLL. Is it possible at all? Commented Apr 3, 2019 at 8:20
  • AcademyofProgrammer the async and await keyword is actually a compiler service. Therefore, it requires the platform support. You can see this for more details stackoverflow.com/a/12600602/744343 As @jsanalytics mentioned, for new development, you should do the .NET Standard instead of PCL Commented Apr 4, 2019 at 1:39
  • @jsanalytics I cannot incapsulate CameraCaptureUI into .NET Standart DLL to use in WPF project. That is the issue. Any clue how to do it? Commented Apr 4, 2019 at 4:54

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.