Monday, January 14, 2013

Referencing the Windows Runtime from Desktop Apps

Most people think of the Windows Runtime as being synonymous with the formerly-known-as “Metro” applications, now called Windows Store apps. To add to the confusion, of course, is the fact that the ARM-based version of the Windows OS is branded as Windows RT. Programmers, being lazy, like our abbreviations so the runtime has been adopted by the world at large as WinRT. Did you know you can reference WinRT from desktop applications? It’s possible, but not easy nor straightforward.

There are actually two approaches you can follow if you wish to build a desktop application that references the Windows Runtime. The first, through the IDE, works like this:

First, create your project and target the .NET Framework 4.5 or later. You see what I did there? By using “later” I’m hoping this post will still be relevant next year. Once your project is created, right-click on the project node and select Unload Project. You should get something like this:


Now edit the project and add the following tag inside a PropertyGroup element:


Reload the project and you’ll now have access to WinRT. If you go to the Add References tab, There will be a new option to add the Core for the Windows Runtime:


Be sure this is included. You might feel like you’re good to go, but there’s actually more to it. Trying to reference WinRT components and compiling will result in an error like this:


You need to add another reference to System.Runtime.dll – to do this, browse to the folder:

c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades

You know the drill: if you’re on 32-bit, remove the (x86) portion. There you will find any other necessary DLLs you need to build and compile your application. If that seems like a lot of work, it is. You could try an alternative. My colleague Jeffrey Richter shows you how to do it from the command line in Using the Windows Runtime from a Non-Metro application.

You’ll quickly learn that not all APIs are available to desktop applications, and some that are available on the desktop aren’t available to Windows Store apps. If you are in doubt, consult the MSDN documentation for the API in question. You will see what is supported at the bottom under supported client and server:


MSDN also provides a comprehensive Windows 8 API List for desktop apps.

Friday, January 4, 2013

Traveling with Microsoft and the ASUS VivoTab RT

My daughter turns 13 today and to celebrate, our family took a trip to Paris, France. We celebrated Christmas and New Year’s Eve (bonne annĂ©e) there. I recently purchased an ASUS VivoTab RT and turned over my Samsung Series 7 slate to my wife. We decided to travel light and only bring the slates – no heavy laptops. We were gone for 10 days – so how was the experience?

In a word, fantastic! Before I share some updates around the slate itself, I wanted to mention a few technologies that eased my time in Paris.

Windows Phone (Nokia Lumia 900)

I brought my Windows Phone and despite it being the “older version” (nope, don’t have the fancy new “8” yet) it was a life saver and I didn’t feel like I missed a thing. I took all of my pictures on the trip using the phone. While the quality pales in comparison to the professional camera my daughter brought along, it held it’s own. Here’s the gardens of Versailles:

The gardens at Versailles

Here’s the moon peeking out from behind the Eiffel Tower at night. I didn’t even tinker with settings aside from changing the “scene” to “night”:


The ability to take high resolution pictures was also a boon because instead of carrying around Metro maps, etc. we’d simply load up a portion of the map we were going to visit, snap a picture on the phone, then pull it up when needed. Worked great.


We had wireless in the apartment. SkyDrive made it very easy for me to organize my photos on the trip. I would capture pictures all day with the phone, then upload them to SkyDrive and the family would review them on the slate. I also saved some of the materials for my new book so I could edit them on the trip when I felt like it and easily synchronize them back to my laptop when I returned.


Skype is awesome. I purchased a year of unlimited calls to the US and Canada because my cellular phone wasn’t getting good reception in my home office (not a problem specific to any phone, just seems the radiation emitted by my large screen monitors does something). I’ve been very satisfied with the service and Paris was no let down. I used Skype and WiFi on my slate to monitor messages on my home and cell phones (I did not get a data plan, so my cell phone was in airplane mode with WiFi turned on the duration of the trip). It made it extremely easy to check for calls.

It also helped me when I made a little mistake. I scheduled a shuttle service to pick us up the last day in Paris and bring us to the airport. We were waiting for the shuttle and it did not show, so I went online to track it and was told I could only track within 2 hours of the service date. Puzzled, I opened my confirmation email and found I had scheduled it for the wrong day! The service was US-based so I used Skype to call in and correct the error – and we made it home fine.

Bank of America

Bank of America has a great app for Windows 8 and I used it to track my various purchases and withdrawals and track against the exchange rate, etc.

Super Voltage and Ragdoll Run

Some of the lines were a bit long. We waited three hours to gain entrance to the catacombs! Having Super Voltage on my phone kept my daughter occupied for most of that time, as well as on the 18 hours of air time we spent traveling between Atlanta and Paris. I personally am a fan of Ragdoll Run.

Now to the Slate …

So how was the slate experience?

After having it for this time and relying on it during the trip, I can say it was fantastic. I could do everything I wanted: listen to music, keep up with news, post pictures to Facebook, manage pictures, write, Tweet, etc. The extremely long battery life meant I could watch videos and play games on the flights without the battery even showing a dent.

There were some negatives. Specifically, some of the Paris sites I wanted to visit used Flash and for some reason didn’t work with the Internet Explorer 10 even in desktop mode (what was really weird was the interactive Paris Metro application worked for a few days then started complaining that I didn’t have the right plug-in). That was solved by pulling it up on my wife’s slate. The other issue was that the Word version doesn’t support the macros my publisher provided for formatting the book, so I decided not to work much on that for fear of losing formatting, etc.

Update: turns out I just didn’t know the right way to configure the macros. I have full support and can edit my book on the go with this laptop as well. WOW! Loving it even more.

Those are not deal-breaking issues for me, however, because I don’t expect to have 100% productivity on my slate – it’s a nice, lightweight, portable device and I’m not looking to develop code for it (nope, that’s going to be my next investment, and I’m getting very excited).

Beyond the Slate

So just as a final note, I have to make a purchase soon for a more primary development laptop. I know there are a lot of models coming out in the next few months but I’m not in a position to really wait. I’ve been to several stores and tried out various models. Right now my favorite hands-on model is the ASUS 13.3” Zenbook Ultrabook. It is light, thin, responsive, and fun to use. I liked the form factor better than the Lenovo IdeaPad Yoga 13, but Lenovo has the best keyboards by far in my opinion (ASUS was a great keyboard compared to all of the other models I tried, but the Lenovo keyboard is still my favorite to type on). Therefore, I’m holding out to test drive a Lenovo ThinkPad X1 Carbon Touch.

What do you think?

I know many of you have invested or tried out your own devices, or are currently looking. I am amazed at how far technology has come and how different this trip was compared to the last time I visited 15 years ago (nope, no looking up the Metro online back then). What are your thoughts and experiences? Please share in the comments below.