Why can I not use Windows.Media.Capture?

Charles Kinzel 21 Reputation points
2021-11-08T22:31:58.827+00:00

using Windows.Media.Capture;
also tried System.Windows.Media.Capture

"The type or namespace name 'Capture' does not exist in System.Windows.Media"

I am developing in Unity 2020.3.18 with the HoloLens 2 and Visual Studio 2019. I have added reference assemblies PresentationCore and WindowsBase.

HoloLens Development
HoloLens Development
HoloLens: A family of Microsoft self-contained, holographic devices that enable engagement with digital content and interaction with holograms in the surrounding environment.Development: The process of researching, productizing, and refining new or existing technologies.
387 questions
0 comments No comments
{count} votes

Accepted answer
  1. Hernando Ren 2,166 Reputation points
    2021-11-09T07:17:25.82+00:00

    Hello, Welcome to Microsoft Q&A,

    You should wrap around any WinRT-leveraged code in the ENABLE_WINMD_SUPPORT compiler directive to only use certain code when compiling against UWP. For more information please see:Universal Windows Platform: WinRT API in C# scripts

    ----
    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful