You can develop and debug applications using a physical Windows Phone 7 device; in fact, this is recommended at least as a final step because the emulator does not provide all the functionality of a hardware device and may not portray your application exactly as it will appear and behave on a real phone.
Connecting a Physical Device
To connect a physical Windows Phone 7 device to your development computer, you must install the Microsoft Zune® software. If it was not provided with your device, you can download the Zune client software from the Zune website (http://go.microsoft.com/fwlink/?linkid=192182). The Zune client allows you to connect your device using a USB cable or through a wireless connection.
Registering and Unlocking the Device
Before you can deploy, test, and debug Windows Phone applications on a physical device (a process known as side loading), you must create a developer account at the Microsoft Windows Phone Marketplace that grants you the right to publish and distribute your applications to the phone. If you have not already created an account on App Hub (http://create.msdn.com/en-us/home/membership), do so now.
After your account is verified, you must run the registration tool to unlock your phone. This uses the Zune software, which must be installed on your development computer, and the Windows Phone Developer Registration tool that is installed with the Windows Phone Developer Tools. After the registration succeeds, you can deploy applications to the phone. You can also unregister the device if required using the same tool.
If you try to register and unlock a device that was previously registered, you must either rename the device using the Zune software, or go to the Windows Phone 7 portal and unregister the device.
For full details of the registration and unlocking process, see “How to: Use the Developer Registration Tool for Windows Phone” on MSDN (http://msdn.microsoft.com/en-us/library/ff769508(VS.92). aspx).
Deploying Applications to the Device
After you connect and register your device, you can deploy an application to it during development by selecting Windows Phone 7 Device in the drop-down list in the Standard toolbar in Visual Studio or Visual Studio Express.
Applications are deployed as a single package with the .xap file extension that contains all the files required to run the application. Visual Studio creates the XAP package and deploys it to the emulator or physical device when you run the application in the development environment.
After you finish developing and testing your application, you can host it in your Windows Marketplace account ready for download to any Windows Phone 7 device. In the future, you will also be able to distribute internal applications for your organization through a private cloud-based service, although the mechanics of this are not currently determined.
Using the Windows Phone Connect Tool
If you are building media applications that interact with the media APIs, you will not be able to debug these while the Zune software is running. For example, if your application uses Media Launchers or Choosers, the XNA Framework for song playback, or the Silverlight MediaElement control to play video or audio content, you must use the Windows Phone Connect Tool to debug your application.
The Windows Phone Connect Tool is part of the October 2010 update to the Windows Phone Tools, which is available from the Microsoft Download Center (http://www.microsoft.com/downloads/en/details.aspx?FamilyID=49B9D0C5-6597-4313-912A-F0CCA9C7D277&displaylang=en).
The Windows Phone Connect Tool (WPConnect.exe) is installed by default in the %ProgramFiles%Microsoft SDKsWindows Phonev7.0ToolsWPConnect folder. To use the tool:
- Connect your Windows Phone to your computer and ensure that it is detected by the Zune software.
- Close the Zune software after your Windows Phone is connected.
- Open a command prompt and navigate to the folder containing WPConnect.exe.
- At the command prompt, enter the command WPConnect.exe.
For more information, see “How to: Use the Windows Phone Connect Tool” on MSDN (http://msdn.microsoft.com/en-gb/library/gg180729(v=VS.92).aspx).