Could not find SDK “SQLite.WinRT” - Add Reference

2019-05-23 05:16发布

问题:

I'm trying to create a Multi-device hybrid app that uses Typescript, WinJS, and a persistent local database. I've got it working to the point of rendering WinJS controls.

However, when I attempt to add WebSQL functionality according to the instructions for adding a Cordova plugin (go to config.xml file--> under plugins tab, check WebSQL Polyfill), it will no longer compile.

The compiler error is C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets(1886,5): error MSB3774: Could not find SDK "SQLite.WinRT, Version=3.8.2". [C:\Users\Lee\Documents\JSApps\TurnstileTS\TurnstileTS\bld\Debug\platforms\windows8\CordovaApp.jsproj]

I have all the latest versions of the SQLite binaries (both Win8 and Win8.1). I realize that the plugin seems to depend on v3.8.2, so I tried to add the NuGet package using the command line:

install-package SQLitePCL -Version 3.8.2

This installed successfully, but the next set of messages was:

Unable to find a reference to the extension SDK SQLite for Windows Runtime. Verify that the reference to the extension SDK SQLite for Windows Runtime has already been removed. Uninstalling 'SQLitePCL 3.8.2.0'. Successfully uninstalled 'SQLitePCL 3.8.2.0'. Install failed. Rolling back...

This is driving me crazy. I'm normally a C# person, so I realize this might be something simple... but I can't even add a reference to a dll like some other stackoverflow suggestions state. When I right-click on the project and try to "Add Reference..." I get the error message:

Missing value for TargetPlatformWinMDLocation property.

...then nothing.

Any ideas?

[edit] I have Win8, Win8.1, WP8, WP8.1 version of SQLite 3.8.6 installed. I just tried building a Windows Phone version of the app and it works! However, Windows 8 won't build. I set it to x86 instead of AnyCPU and it doesn't change anything.

回答1:

There's a very simple fix to this. For Windows 8, you need to have the VSIX packages for SQLite already installed. Please, note which version number you have installed! As of 10/26/14, I have 3.8.7 installed.

From your solution's folder in explorer, navigate to:

{solution folder}\JavaScript\{project name}\bld\Debug\platforms\windows8

Edit the project's jsproj file in a text editor and scroll down until you see the entries for SQLite.

<ItemGroup>
    <SDKReference Include="SQLite.WinRT, Version=3.8.7" />
</ItemGroup>

Change the version number in your file to the actual version on your computer. The project will build with the WebSQL plugin enabled and will actually work. (I verified the database file created in local storage.)

NOTE - You must already have enabled the WebSQL plugin in the config.xml menu.