Friday, December 17, 2010

Developing on the Win phone 7 hardware without a developer account

Microsoft have released a free toolset for developing Windows Phone 7 applications. However you cannot debug or deploy onto actual hardware until you create a developer account @ $99 per year.

In my case, I only have a demo phone for 2 weeks so a developer account seems like a waste of money.

To work around this restriction, you need to do the following:

1 Unlock the phone:
Download and install the Chevron unlocker and certificate from here.

2 Stop the phone from relocking every time you reboot
Edit your hosts file (C:\Windows\System32\drivers\etc\hosts)
Add the line

You can now deploy and debug on your phone.

Note: the phone will still relock itself every couple of weeks, giving the following error

“[application name] has been revoked by Microsoft. Please uninstall it.”

Just rerun Chevron and unlock again.

2nd note: You can deploy your .xap file to others and they can run them on unlocked phones. However the continual relocking may get annoying.

3rd note: You can't use Chevron to pirate applications. It will only allow you to run unsigned applications.

Monday, December 13, 2010

Developing for Windows Phone 7 in a virtual machine

According to Microsoft, installing the windows phone developer tools into a virtual machine is not supported. This is because the phone emulator is itself a virtual machine and, as Inception has shown, running a virtual machine inside a virtual machine gets really slow. The emulator also requires DirectX 10 for XNA develoment, and current virtual machines only offer DirectX9.

However I do all my development in virtual machines. I already have a VM setup with VS2010, version control, database etc. I don't fancy setting that up all over again just for a phone, particularly one that I only have for 2 weeks.

Time to do some testing...

Virtual PC
Running the dev tools in a Windows 7 Virtual PC works (or rather fails to work) as advertised. While I could create and compile a phone project, I couldn't actually run it in the emulator.

Using a VMware vm was much better. I could compile and run a silverlight project on the emulator. On my laptop, the emulator performance was dire. On my desktop however, emulator performance was adequate but not stunning.

On either machine, XNA projects wouldn't run on the emulator due to the lack of DirectX 10. They would compile but trying to deploy would fail with "The current display adapter does not meet the emulator requirements to run XNA Framework applications."

However deploying and running on a real phone worked fine. Both Silverlight and XNA deployed and ran without any issues.

Booting from a virtual hard drive (thanks Paul)
Should work but requires Windows 7. See here.

You can develop Silverlight applications in a VMWare virtual machine, testing against the emulator (slow) or actual hardware (fast). You can develop XNA applications in a VMWare vm but you need to deploy to actual hardware.

Useful links
Microsoft's free tools: Create App hub
Charles Petzold giant ebook: Programming Windows Phone 7
Reddit Win Phone 7 section: