samedi 17 octobre 2015

SQLite in VS2015 MVC 6.0.0-beta8 not working

Can't get SQLite to work on an MVC6 beta 8 project.

To reproduce the problem, assuming you have beta 8 already installed in Visual Studio 2015:

  1. Create a new empty WebApi project

  2. In project.json, under frameworks remove dnx5, leaving just dnx451

  3. Create an empty test.dat file in your wwwroot folder

  4. Install latest 1.0.98.1 SQLite with Nuget: Install-Package System.Data.SQLite

  5. In startup.cs add using System.Data.SQLite and System.IO and put this 2 lines into public Startup(...

    string folder = Directory.GetCurrentDirectory();

    SQLiteConnection conn = new SQLiteConnection(@"Data Source="+folder+"test.dat");

Hit F5 and you will get Unable to load DLL 'SQLite.Interop.dll'

There are lot of questions and answers about this topic for previous versions of VS... I tried mostly everything including building for x86 and x64, install other nuget packages (Core / PCL / bare SQLite / Entity, etc) and so on. There are some workaround copying files by hand, but I need this to deploy on a server without much intervention.

Its hard to believe that the most used compact database in the world can't work out of the box in VS2015, so I'm hopping that I'm doing something incredibly wrong and someone can shed some light.

Thanks.-

Aucun commentaire:

Enregistrer un commentaire