Opening a Windows Phone project after you have upgraded SQLite

If you are using the SQLite for Windows Phone package in Visual Studio, and you install one of the upgrades (which happen relatively frequently), the next time you open C++ project that references SQLite the project will fail to load with an error similar to this in the Output window:

D:\Path\ProjectName.vcxproj : error : Unable to read the project file "ProjectName.vcxproj".

D:\Path\ProjectName.vcxproj(60,5): The imported project "C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\ExtensionSDKs\SQLite.WP80\\DesignTime\CommonConfiguration\Neutral\SQLite.WP80.props" 
  was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

Fixing this is pretty easy, but requires manual editing of the project file. Here's what to do:

  1. If the project is under source control, check it out first. You need to do this manually from the Source Control Explorer, since right-clicking on the Solution Explorer won't work
  2. Open the project file for editing (either from the Source Control Explorer or by right-clicking on the project in Solution Explorer and choosing "Edit ProjectName.vcxproj" )
  3. Search for "SQLite.WP80" in the source code; you should get 9 hits on 5 different lines (the number may vary depending on how many build configurations you have)
  4. The first set of hits should all be inside <Import> statements. Look for the version number after highlighted search text (eg, "") and replace it with the new version (eg, "3.8.2")
  5. The last hit will be at the bottom of the file, and is in an <SDKReference> element. Again, replace the old version number with the new version number
  6. Save the project file
  7. Restart Visual Studio. Important: do not try to re-load the project; it won't work. You must restart Visual Studio
  8. Reload your project and build; it should work
  9. Check the changes back into source control (if applicable)

In theory you could just do a search-and-replace for the old version number with the new version number, but just in case something else in your project has that string, I prefer to do it manually (it's not very difficult).