How to Interop with Windows Runtime in .NET 4.5

狂风中的少年 提交于 2019-12-05 15:28:48

A .NET console mode app or a WPF app are not Metro applications. They can only run on the 'regular' version of Windows. The traditional desktop in the case of Windows 8. So can't interop with WinRT, it isn't loaded in the process. Targeting WinRT requires selecting a specific Metro project template when you start your project.

You need to add this to the project file:

<PropertyGroup>
  <TargetPlatformVersion>8.1</TargetPlatformVersion>
</PropertyGroup>

For more details, see How to use specific WinRT API from Desktop apps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!