Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LocalDB is not supported on this Platform

I'm trying to launch .Net Core 2.0 application on Ubuntu 17.04. I developed it on Windows 10 before and it works well. The problem is that when I run dotnet ef database update I get the next exception:

System.PlatformNotSupportedException: LocalDB is not supported on this Platform. 

Here is my DbContext:

public class NutritionContext : DbContext {     public DbSet<User> Users { get; set; }     public DbSet<Meal> Meals { get; set; }     public DbSet<Dish> Dishes { get; set; }     public DbSet<Product> Products { get; set; }     public DbSet<Plan> Plans { get; set; }     public DbSet<MealDish> MealDishes { get; set; }     public DbSet<Ingredient> Ingredients { get; set; }     public DbSet<PlanDetail> PlanDetails { get; set; }     public DbSet<UserPlan> UserPlans { get; set; }     public DbSet<AuthUser> AuthUsers { get; set; }      public NutritionContext()     {     }      public NutritionContext(DbContextOptions options) : base(options)     {                }      protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)     {         optionsBuilder.UseSqlServer(             "Server=(localdb)\\mssqllocaldb;Database=NutritionDatabaseNew;Trusted_Connection=True;MultipleActiveResultSets=true");     }  } 

Do you know what could be the reason of it?

like image 344
YTerle Avatar asked Aug 24 '17 11:08

YTerle


People also ask

How do I install LocalDB on SQL Server 2016?

Install LocalDB through the installation wizard or by using the SqlLocalDB. msi program. LocalDB is an option when installing SQL Server Express LocalDB. Select LocalDB on the Feature Selection/Shared Features page during installation.


1 Answers

LocalDb is a packaging mechanism for SQL Server Express Edition, and is only available for Windows. On Ubuntu you can install regular SQL Server Express Edition.

https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-overview

Here are the install scripts for Ubuntu, Red Hat, and SUSE.

Or use the Docker Images:

https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker

like image 200
David Browne - Microsoft Avatar answered Sep 20 '22 20:09

David Browne - Microsoft