1
votes

I have a problem with Sqlite in my Windows Phone 8 app. I followed the ususal guides, where you have to add sqlite-net and sqlite-net-wp8 NuGet package, then add compilation parameter USE_WP8_NATIVE_SQLITE and then add link to Sqlite for Windows Phone Visual Studio Extension.

I have a problem with the last step because it requires specific Visual Studio extension to be installed and therefore it's not compatible with our requirement to have all source files and libraries in Git repository, without need to install any additional plugins when running Continuous integration or setting a machine for a new developer.

When I tried to add reference to the sqlite3.dll located in
C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\ExtensionSDKs\SQLite.WP80\3.8.7.4 \Redist\Retail\x86\sqlite3.dll
I got error "A reference to a higher version or incompatible assembly cannot be added to the project."

Is there a way how to overcome this problem and have all necessary Sqlite libraries in my Git repository, without referencing VS Extensions that need to be installed?

2
Follow the guide fully, compile the app, look at output folder and see what SQLite DLL are there - use those?Neil Turner

2 Answers

0
votes

I know this is old, but I recently did something similar. Here is the approach I took:

  1. Install the extension, and copy the files from C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\ExtensionSDKs\SQLite.WP80 and copy to your $(SolutionDir)packages directory

  2. Edit the $(SolutionDir)packages\DesignTime\CommonConfiguration\neutral\SQLite.WP80.props file that is included in the package and change the path of IncludePath and LibraryPath:

<IncludePath>$(SolutionDir)packages\SQLite.WP80\latest\DesignTime\CommonConfiguration\Neutral;$(IncludePath)</IncludePath>

<LibraryPath>$(SolutionDir)packages\SQLite.WP80\latest\DesignTime\$(PackageConfiguration)\$(PlatformTarget);$(LibraryPath)</LibraryPath>

  1. Modify the SQLite.vcxproj file A. Add Property groups to add location of sqlite3.dll

`

<PropertyGroup>
    <SQLiteBase>$(SolutionDir)packages\SQLite.WP80\latest\Redist</SQLiteBase>
    <SQLiteWin32Debug>$(SQLiteBase)\Debug\x86</SQLiteWin32Debug>
    <SQLiteWin32Release>$(SQLiteBase)\Retail\x86</SQLiteWin32Release>
    <SQLiteArmDebug>$(SQLiteBase)\Debug\ARM</SQLiteArmDebug>
    <SQLiteArmRelease>$(SQLiteBase)\Retail\ARM</SQLiteArmRelease>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <SQLiteBinPath>$(SQLiteWin32Debug)</SQLiteBinPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <SQLiteBinPath>$(SQLiteWin32Release)</SQLiteBinPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|Win32' ">
    <SQLiteBinPath>$(SQLiteWin32Debug)</SQLiteBinPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Win32' ">
    <SQLiteBinPath>$(SQLiteWin32Release)</SQLiteBinPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|ARM' ">
    <SQLiteBinPath>$(SQLiteArmDebug)</SQLiteBinPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|ARM' ">
    <SQLiteBinPath>$(SQLiteArmRelease)</SQLiteBinPath>
  </PropertyGroup>

`

B. Change the ImportGroup for the props file to reference the path in solution:

<ImportGroup Label="PropertySheets"> <Import Project="$(SolutionDir)packages\SQLite.WP80\version\DesignTime\CommonConfiguration\Neutral\SQLite.WP80.props" /> </ImportGroup>

C. Change the ItemGroup where the it references the SDK and change it to add the sqlite3.dll

<ItemGroup> <CustomBuild Include="$(SQLiteBinPath)\sqlite3.dll"> <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent> <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent> <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent> <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent> </CustomBuild> </ItemGroup>

0
votes