Windows Phone 7: Taking and restoring a SQL database
As I develop my first Windows Phone 7 application, My Video Game Tracker, I want to make sure that the many games I've added won't accidentally be lost (as I'm deploying test versions to my physical phone).
The below assumes you're using Windows PowerShell, but they should run on the standard command line.
Taking screenshots of the application's data
When you install the Windows Phone SDK the Isolated Storage Explorer Tool is also installed. This tooll allows you to easily explore isolated storage on both emulated devices and any plugged in devices.
First you'll want to go to the directory where the tool is installed.
cd "C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.1\Tools\IsolatedStorageExplorerTool"
You can now enumerate devices if you want, but there's two parameters that you can tend to rely upon.
To continue, you'll need to have the guid of the application, which can be found in the WMAppManifest.xml file, and it's the ProductID attribute in the App element.
First, make sure that the application has been started, and any necessary data items have been setup.
Next get a directory listing, so you have an idea of what it looks like.
.\isetool.exe dir xd 00000000-0000-0000-0000-000000000000
This would return something like the following.
Now you can take a screenshot to any directory you like. For example, to grab it from your phone (de = physical device):
.\isetool.exe ts de 00000000-0000-0000-0000-000000000000 D:\projects\JamesRSkemp\WindowsPhone\isolatedstorage
When you run this command you'll have a directory created in the above called IsolatedStore. This will mimic what the dir command above returns.
To take a screenshot of the default emulated device (512 MB emulator), run the above except with xd instead of de.
.\isetool.exe ts xd 00000000-0000-0000-0000-000000000000 D:\projects\JamesRSkemp\WindowsPhone\isolatedstorage
Restoring screenshots of the application's data
Now if you want to restore the screenshot you want to make sure you append IsolatedStorage to the end of the directory path.
.\isetool.exe rs xd 00000000-0000-0000-0000-000000000000 D:\projects\JamesRSkemp\WindowsPhone\isolatedstorage\IsolatedStore
Depending upon what you're storing, if you want to move data from one device to another, you can take a screenshot, replace the necessary file(s), and then restore the modified screenshot/directory.
As I've been developing I've run into two errors. The message and resolution are below.
Error: The process cannot access the file because it is being used by another process.
To resolve this error you need to close the application (back button from the home screen).
Error: Failed to connect to the device. Ensure that the device is completely booted and is connected to the PC.
To resolve this error you need to make sure Zune is running and the device is connected, and unlocked.
- How to Backup SNES Saves With the Super UFO Pro 8
- Review: Pfister Weller LG49-WR0K 2-Handle 8-inch Widespread Bathroom Faucet in Brushed Nickel
- Review: Sony HT-CT80 Soundbar Home Speaker
- Review: Petstages Channel Scratcher Catnip Blasted Scratching Post Station for Cats, Large
- Review: Anpro Stainless Steel Heavy-duty Fruit and Vegetables Masher, Potato Ricer
Support This Site
If my blog was helpful to you, then please consider visiting my Amazon Wishlist.