I’m currently testing a Nokia Lumia 800 and might switch over from iPhone if everything works as it should. So far I’m very impressed with the speed of the device, and direct editing of Office documents is at last possible again. Of course one of the benefits of coming back to Windows Phone (last Windows Phone I had was an HTC HD2 running Windows Mobile 6.5) is that it’s easier for me to create Apps. Therefore I just created my first Windows Phone 7 App. Following tradition, it’s a “Hello, World” App.
Here are some pointers how to get started with Windows Phone development. Since I don’t like to clutter my main workstation or notebook with too many applications I decided to create a virtual machine for development. So first install Windows 7 in a VM, integrate it in the network, and install the latest patches if you’re going down that road, too.
Next, or while your development VM is installing, head over to MSDN, more specifically to the App Hub for Windows Phone and Xbox Developers. Use a Live ID to log in, and start reading… I found the “Windows Phone 7 Jump Start” sessions of Windows Phone MVPs Rob Miles and Andy Wigley a good start. Once you’re good to go, download the Windows Phone 7.1 SDK from the App Hub site (“resources” > “download”). It contains pretty much all the tools you need to get you started, including Visual Studio 2010 Express for Windows Phone. The download is only around 4 MB; it’s a tool that will download the needed components , roughly 700 MB, from the internet and install them. After that the system needs to be restarted.
After the restart I opened Visual Studio. The only thing I changed in Options is the default path for my projects, “d:\projects” instead of the system default in the user’s “Documents” folder. For this setting to be visible I had to enable the “Show all settings” checkbox in the lower left corner. And you might want to enable “Expert Settings” in the “Options” > “Settings” menu.
Now click on “New Project”, select the “Windows Phone Application” template and select a Name. The “Solution name” will also change accordingly to what you set in the “Name” field.
The rest is easy enough. From the left hand “Toolbox”, drag a TextBox and Button to your Windows Phone MainPage, and change their captions and the App Name according to your tastes. You can use the small pin Icon in the Toolbox title bar to keep the toolbox from sliding out again.
Then doubleclick the button, which will open the buttons “click” (i.e. single tap in Windows Phone) event. All you have to enter now is one line of code to change the text box’s caption/text to “Hello, World!!”.
Now you can run your first application by hitting the “run” button:
Based on your virtualization technology (for me a XenDesktop Express connection to a vSphere 5 hosted VM) it’s possible you’ll get a warning about the Windows Phone emulator not being supported… This is mainly a problem if you’re developing games using the XNA framework, and Silverlight applications might be slightly reduced in functionality. I think basic Windows Phone applications should still run ok.
A few remarks
If you want to publish stuff on the Marketplace (Microsoft’s version of the App Store) you’ll need to register as a developer (in Application Hub) and pay an annual fee. And no, you don’t necessarily need a Windows Phone to develop stuff. But while the emulator might do the trick for basic functionality checks I personally prefer to see the real deal on a real world device at some point. My thanks go to Sascha Corti, Developer Evangelist at Microsoft Switzerland for giving me some pointers on how and where to start.