This is a mirror of official site: http://jasper-net.blogspot.com/

How to call WinRT APIs from C# Desktop applications – list the installed Metro packages

| Wednesday, June 27, 2012
As Jaime Rodriguez detailed in April, Windows 8 Excellence Labs are made to help Metro developers to get a token which allows them to submit their application to the Windows Store with high confidence. I’m lucky enough to be part of this Microsoft effort and I hope meeting some of you soon :^)

A tool has been built to help Microsoft engineers to more easily check some basics of a Metro App such as implemented contracts or logos. This is a WPF Desktop application written in C# and its first task is to enumerate the installed Metro App packages.

I can imagine other scenari where you will certainly be interested in automatically checking that your application is well installed. This post will detail how a .NET developer could leverage WinRT from his Desktop application.

How to see the WinRT APIs in VS/.NET Decompiler
When you create a blank Metro App in C# with VS 2012 RC, two references are added to the project:

Inline image 1

The first one allows you to use .NET types and the second one is the .NET view of the WinRT APIs. When you display the properties of the latter:

Inline image 2

you end up in the C:\Program Files (x86)\Windows Kits\8.0\References\CommonConfiguration\Neutral\ folder where Windows.winmd waits for you. As explained by Martyn Lovell during his Lap around the Windows Runtime BUILD session, the WinRT team decided to keep the metadata format used by .NET assemblies to define their types and members.

QR: Inline image 3

Posted via email from Jasper-net

0 comments: