Forum Xamarin.Forms

Need code sample for Xamarin.forms using entity framework core 2.0 with migration support

KrunalKrunal USMember ✭✭
edited March 2018 in Xamarin.Forms

I'm trying to create new app from scratch using Visual Studio 2017 (15.5.6) & Xamarin ( Through nuget I added reference of "EntityFramework Core" 2.0. I also added Sqlite related nuget packages in my .net standard projects.

I added my model classes and datacontext in .net standard project. Now I want to perform the migration and create the new database. Also, want to perform the subsequent migrations for any model related changes.

When I try to run migration using the command "dotnet ef migrations add ", get Build error.

error MSB4062: The "Xamarin.Forms.Build.Tasks.GetTasksAbi" task could not be loaded from the assembly C:\Users\.nuget\packages\xamarin.forms\\build\netstandard1.0\Xamarin.Forms.Build.Tasks.dll. Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

Build Failed.

From above log, can anybody suggest any fix in order to overcome this issue (though through visual studio when I build my code, it builds properly) and create migration?

Also, I looked for some working sample of EF Core 2.0 in Xamarin.Forms with migration but couldn't find any sample so far. All samples just shows the simple entity class which in turn create db upon run but not further migrations. This creates doubts in my mind whether migrations are supported yet or not?



Sign In or Register to comment.