Mobile Zone is brought to you in partnership with:

Den is a DZone Zone Leader and has posted 460 posts at DZone. You can read more from them at their website. View Full User Profile

How to run multiple instances of the Windows Phone 7 emulator

01.12.2011
| 9003 views |
  • submit to reddit

Sometimes there are cases when you want to run multiple instances of the Windows Phone 7 emulator. For example, to test different command line options in separate instances. By default, you cannot customize this behavior in Visual Studio 2010, that by now is the standard way to access the emulator. However, there is still an option provided by Microsoft that is not mentioned too often.

First and foremost, you should be familiar with basic command line operations - how to launch applications from command line and how to send specific parameters when executing an application (or script, for that reason). If you are familiar with these concepts, then you are good to go.

Second, you need to know where the emulator and the default development WP7 OS image are located. On my system, I can find them in the following folders.

WP7 OS Image:

C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.0\Emulation\Images

WP7 Emulator:

C:\Program Files (x86)\Microsoft XDE\1.0

If you try running XDE.exe from the emulator folder right away, you will be prompted with this message:

Not exactly what we're looking for, but nonetheless it is helpful. So the emulator by itself won't start - I need to specify an OS image to be loaded. And here is when the console comes into play. Open the system console by pressing the Win+R keys and then typing CMD and clicking OK.

Once the console is open, first of all copy and paste the path to the emulator, and then after a space, copy and paste the path to the OS image.

The complete path string should look like this:

"C:\Program Files (x86)\Microsoft XDE\1.0\XDE.exe" "C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.0\Emulation\Images\WM70C1.en-US.bin"

And once you run it... nothing happens. Besides the actual image, you need to pass a VMID - a GUID identificator that will be uniqued to the specified instance.

NOTE: You can generate GUIDs quickly here.

The VMID parameter is required to be unique for every given running instance. Otherwise, you will be getting an error message like this:

Here is how you should pass the VMID to the emulator:

"C:\Program Files (x86)\Microsoft XDE\1.0\XDE.exe" "C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.0\Emulation\Images\WM70C1.en-US.bin" /VMID {3e7d1f17-dbf6-4e74-b1ef-20206c5fe7b9}

Curly braces are required.

Once you run this command, the emulator should do a full OS boot (no, the main applications will still be locked) and will get in the "Ready" mode in around 30 seconds. As long as you change the GUID, you can run as many instances as your machine allows you to.