How to create a COM object in a UWP application? (C#)

前端 未结 4 1073
伪装坚强ぢ
伪装坚强ぢ 2020-12-25 08:17

Question: How to create COM object in a Universal Windows Platform (UWP) application?

Motivation: I want to switch from WPF to UW

4条回答
  •  青春惊慌失措
    2020-12-25 08:40

    As you note, it isn't possible to access arbitrary COM objects from a Universal Windows app. It is likely your third party libraries also use API which aren't available directly from within the Windows Runtime.

    Assuming you intend to sideload the app rather than deploying through the store you can call your COM objects and libraries indirectly through a Brokered Windows Runtime Components for side-loaded Windows Store apps (docs for Windows 8.1 but still valid for Windows 10). This feature is designed for enterprise apps to provide a modern UI while still having access to existing functionality.

    If you want to deploy through the store then you will stay restricted to the API allowed in the Windows Runtime context and can't use a Brokered Windows Runtime Component.

    If your main goal is to deploy through the store and you don't need to otherwise convert to a Universal app then take a look at the upcoming Windows Bridge for Classic Windows apps (also called ”Project Centennial”) which will allow packaging your current .Net project for store deployment and will allow extending it to use some UWP capabilities.

提交回复
热议问题