Search code examples
c#uwpruntimedesktop-bridge

Determine if C# application is running as a UWP app in Desktop Bridge (Project Centennial)


How to check if application is running as UWP?

Almost the same question, but I need it for C#, not C++.

If I try to get ApplicationData.Current.LocalFolder and application is running as Win32 application, it throws exception:

An unhandled exception of type 'System.InvalidOperationException' occurred in applcation.exe Additional information: The process has no package identity. (Exception from HRESULT: 0x80073D54) occurred

How can I check type of application without exception?


Solution

  • Have you seen this MSDN article? Desktop Bridge – Identify the application’s context

    It has a sample that shows how make the app behave differently, depending the running mode (win32 desktop application or desktop bridge app).