How to edit Windows Phone Emulator Image hosts file?

csharpwinphonexaml picture csharpwinphonexaml · Apr 7, 2014 · Viewed 12.5k times · Source

I am developing a Windows Phone App and i wanted to test In-app Purchases functionality in my app.

Microsoft Provides a webservice to test IAP but since the os automatically connects to Windows Phone Store, there's no way to test if the application is handling the IAP properly

How can this be done?

Answer

csharpwinphonexaml picture csharpwinphonexaml · Apr 7, 2014

I Found this while preparing my environment for this purpose:

There is a folder in the computer where you can find the .vhd files of the Virtual Machines used to emulate Windows Phone.

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

Here you can find all the Emulator Images:Emulator Images

Remove Read Only Attribute from the VHD file you want to edit: Remove Read-Only Attribute

Mount VHD file (Windows 8 or above is done by simply double clicking the file or opening it with explorer)

After doing so you should see 5 extra partitions Extra Partitions

2 of those partitions are system partitions you can identify them because they have between 15% and 40% free space

2 Partitions

From those 2 partitions the one we care about is the partition witch contains Users Folder. Now we must go to the following path:

YourDriveLetter:\Windows\System32\DRIVERS\ETC

Hosts file witch we must change

in this file we must set the mapping

yourmachineip marketplaceedgeservice.windowsphone.com

192.168.1.109 marketplaceedgeservice.windowsphone.com

Save the file and eject the first partition enter image description here

Now you're done with configuring the Mapping this of course is useless if you haven't configured your machine to use the WebService provided by Microsoft to test IAP