Raf's laboratory Abstracts Feed Raffaele Rialdi personal website

I am Raf logo

Essential WinRT part 1: The package

October 13, 2011
http://www.iamraf.net/News/essential-winrt-part-1-the-package

During the build conference sessions, beyond the great thrilling sessions like the one from Matt, I had the change to make me explain many interesting details about WinRT. So I want to thank speakers and the other team members for their availability to answer the numerous questions coming from the attendees. This is an emblematic whiteboard:

2011-09-16 11.47.50

As for me I was enlighted from the comparison with COM and the new activation mechanism, that I am going to quickly recap in these posts.

After you create an application, Visual Studio 11 allows you to generate the package file that is the new Metro-Style applications deploy unit.

Visual Studio allows you to create a package by using the menu "Project – Store – Create App Package". As a result of this command, the wizard performs a series of steps:

  • embedding manifest, metadata, resources, and any other necessary files to the project (dll, etc.)
  • generating package (zip file)
  • signing the package with a certificate

The generated package is the deploy unit and does not take any other dependencies except for the Framework.NET (only if you use a managed language) or VC ++ runtime files (only if you are using C++). The new application will need WinRT that is/will be available only on Windows 8.

This package eliminates the need to create a MSI installer package but the msiexec is not dead at all since as it's used internally by Windows to register the certificate, install the package and register the application in the Windows registry.

The installation can be done by Visual Studio (even without creating the package first), the Windows Store (when it will be available) or a powershell script generated by Visual Studio. This batch requires administrator rights to install the self-signed certificate, which is not the case in the case of installation from the Store/Windows Marketplace.

The package is registered in the system registry excerpt of the current user (HKCU) and this means that a user is able to install Metro applications without requiring administrative rights.

The package will contain the dll files that contain, if any, "WinRT components" (WinRT classes that expose types that are part of the WinRT type system) or "WinRT controls" (as the WinRT components but defining a new Xaml control instead). These are always private and therefore:

  • do not require global registration as for COM or Framework.NET GAC 
  • as they are not global, versioning is not a problem anymore. Each application can use different versions of the same WinRT component.

To administer Metro application packages there are dedicated cmdlets well summarized here, which I'll list:

  • just type Powershell in a command prompt to enter Powershell mode and exit to return to the command prompt
  • get-help appx cmdlet returns the list of specific package
  • get-appxpackage returns the list of packages installed in the system
  • add-appxpackage file. appx installs a package in the system
  • remove- packagefullname appxpackage removes the package (specify the name of the package obtained with get-appxpackage)

Refer to the link above for some handy tricks specific to powershell.

In the next post, we'll see the essential steps of a package registration.



rated by 0 users



Share this page on Twitter


Copyright (c) Raffaele Rialdi 2009, Senior Software Developer, Consultant, p.iva IT01741850992, hosted by Vevy Europe Advanced Technologies Division. Site created by Raffaele Rialdi, 2009 - 2011