I’m developing a multi-player Windows Phone 7 game. Now I don’t know about you, but I find it hard to test a multi-player application when I’m only allowed to run one instance of it. And that seemed to be the case with Windows Phone 7 applications. Microsoft provide an Emulator, but it’s a single-instance application: however many times you click its icon, you only get the one window.
Googling found me a useful article on how to run multiple instances of the emulator. But it didn’t tell me how to deploy applications to them, or how to debug those applications. There was however, a post in the forums, somewhat reminiscent of Monsieur de Fermat scribbling's, that gave me hope that what I wanted to do was indeed possible.
So I set out on a journey of discovery.
Step by Step instructions
Disclaimer: what I am about to show is completely unsupported by Microsoft or me. Continue at your own risk. Here be dragons.
- Open the folder [Your Drive Letter]:\ProgramData\Microsoft\Phone Tools\CoreCon\10.0\addons
- Locate the file ImageConfig.en-US.xsl
- Take a copy of it, leaving it in the same directory, and name it something like ImageConfig.en-US 2nd Instance.xsl
- Open the copy in your text editor of choice.
- Locate the element DEVICE
- Change the Name attribute, and assign a new value to ID – you can use the Online Guid Generator if you can’t think of one off the top of your head.
- Scroll down the file to locate the part that says PROPERTY ID=”VMID”:
- Put a new Guid inside that element – make sure though that you use capital letters rather than lower case.
- Save the file
- That’s it. Re open the XAP deployment tool, or Visual Studio, if you already have them open, and you’ll see your new Emulator instances.
A Bonus Visual Studio tip
To debug multiple instances of your Windows Phone 7 application you can do the following:
- Start the first instance as usual.
- Change the Deployment Device to your newly-minted 2nd Emulator:
- To start the 2nd instance, right-click on your project, go to the Debug menu item, then select Start new instance:
4. Prepare a wet towel and a darkened room in preparation for the multi-player debugging experience.