Using WPConnect instead of Zune for Windows Phone development

Sometimes you get so used to do something everyday that you don't appreciate how much time it saves you. So in this entry I want to go back to the basics and comment on something I had been asked many times. I remember the times where we used Active Sync to connect Windows Mobile devices, is was not that hard but it could get tricky some times, depending if the device was connected via USB or Wi-Fi, emulators via  DMA and more. And to be honest, it was not that long ago. Fortunately the new Microsoft Windows Phone 7 series does this in a pretty easy way.

Zune
Besides being used to download apps, musics, podcasts or to sync content between the computer and the device. The Zune software is what we can easily use to "hook up" your device with your Visual Studio and deploy apps to your phone.

If you are a registered developer at Microsoft Marketplace just connect your unlocked/activated phone. Run Zune if not setup to auto-start. Then on the Visual Studio just  select to run on the device rather than on the emulator.

And that's it!

The catch...
While you are using Zune you will not be able to debug code related to the MediaLibrary,  that means anything related to open photos from phone albums or photo chooser task, music files, etc. The reason seems obvious since Zune is a synchronization software so it will be using those components. Although that could work better. The solution is to use the WPConnect.exe tool that comes with your Windows Phone SDK.

WPConnect.exe
This executable file is located on your SDK folder. Go to C:\Program Files(x86)\ Microsoft SDKs\Windows Phone\v7.1\Tools\WPConnect\ and there is the program. Select the x64 or x86 folder depending if your are running 32 or 64 bit OS. Then run the WPConnect.exe from that folder. My phone is named "hobbit" see the screenshot below:


Now as a side note, Zune must be closed before running WPConnect.exe but you have to run it first when you plug in your device. So the steps are:
  1. Plug in your device.
  2. Run Zune if is not setup to auto-start.
  3. Unlock your device if it has a PIN number.
  4. Close Zune
  5. Run WPConnect.exe
Think of the steps 1-3 as a "handshake" because you won't need to do it again, and that's what you do every day when using Zune to sync to your phone. If the connection drops and Visual Studio fails to deploy the app, you can just re-run WPConnect.exe and you are good to go.

When connected using WPConnect you can debug your apps even if you make use of the media library on your phone. The only downside so far is that the WP7 is still missing the wireless support for development, which is something that we did have one Active Sync, and we need mainly when  developing apps that use the accelerometer or gyroscope and need to fight with moving/tilting the phone around attached to a 6 foot USB cord.

Comments

Popular posts from this blog

Get-ChildItem vs Dir in PowerShell

The case for a 4 week sprint

NODE.js fs.readFile and the BOM marker