EFCore SqlClient error LocalDB

c# entity-framework-core localdb uwp


I'm testing EFCore 2.0.3 in a UWP project using System.Data.SqlClient.

If I connect to a SQL Server instance, it works OK, but when changing to LocalDB, I get an error:

LocalDB is not supported on this platform

My connection string is this:

Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFileName=\Statistics.mdf;Initial Catalog=Statistics;Integrated Security=True;Connect Timeout=30

My LocalDB version is (using SQL Server 2016): v13.1.4001.0

EFCore 2.0.3 does not support LocalDB, or am I missing something?

5/11/2018 4:35:16 AM

Popular Answer

From .Net standard 2.0, we can use the SQL Server database in a UWP app, but your UWP app must configure target version and min version 16299 or more higher version. You can change them by right click your project => Properties => Application tab.

You can see the document Use a SQL Server database in a UWP app and the sample: https://github.com/StefanWickDev/IgniteDemos/tree/master/NorthwindDemo

Besides, here is also a similar thread you can have a reference:

How to connect to SQL server database from a Windows 10 UWP app


Currently, UWP app doesn't support the LocalDB on 16299 and 17134. But in my test, LocalDB can work well in WPF app and Console app, this is my connect string:

        public string LocalDBConnectionString = @"Data Source=(localdb)\MSSQLLocalDB;
Initial Catalog=master;Integrated Security=True;
Connect Timeout=30;Encrypt=False;
5/14/2018 3:30:15 AM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow