Device platform not found

Sun, April 30, 2006, 09:35 AM under MobileAndEmbedded
Recently I opened a VS2005 Smart Device project that I was assured worked for others, only to face an error message box:
---------------------------
Microsoft Visual Studio
---------------------------
Error retrieving information from user datastore. Platform not found.
---------------------------
OK
---------------------------

When I hit my only choice, which was the OK button, a warning message box appeared:
---------------------------
Microsoft Visual Studio
---------------------------
The project could not be opened because it refers to a device platform that does not exist in your datastore.
---------------------------
OK Cancel
---------------------------

Clicking OK or Cancel had the same effect: the project does not load (i.e. it is "unavailable" in solution explorer).

However, in the top right corner of the warning message box there was the question mark icon. At first I didn't think of clicking on it, since it traditionally is used to get help on UI widgets on the dialog box it appears on. Instead, this one acted as a Help button (why not offer that next to the Cancel button is beyond me) and pointed to this msdn page:

The project you are trying to load targets a device platform that your Visual Studio installation is not configured to support.

To correct this error
Install the platform that supports the project you want to load.

For example if you are trying to load a Windows Mobile 5.0 project and do not have the Windows Mobile 5.0 SDK installed, install the Windows Mobile 5.0 SDK.

So clearly whoever saved that project had saved it while the "Target Device" was set to "Windows Mobile 5.0" (and probably created the project in the first place by choosing the WM 5.0 template). Since the WM 5.0 SDK doesn't ship with VS2005, any machine (like my tablet) that hasn't had the WM 5.0 SDK installed fails to open the project.

As I didn't have time at this instance to download the SDK (or switch to my main machine that has the SDK installed), I opened the csproj file in notepad, located the following line:
<PlatformID>4118C335-430C-497f-BE48-11C3316B135E</PlatformID>
... and changed it to this one:
<PlatformID>3C41C503-53EF-4c2a-8DD4-A8217CAD115E</PlatformID>

Save and close, now reopen in Visual Studio and all is fine (with Target Device set to "Pocket PC 2003").

While it makes no difference, I also changed the OSVersion tag, since it points to 5.01, which is not the WinCE version that PPC2003 is based on: 4.20

Finally note that if you *can* open your project and *then* need to change the platform, you don't have to mess with the text files, simply choose Project->Change Target Platform.