robisim74 / AngularSPAWebAPI

Angular Single Page Application with an ASP.NET Core Web API that uses token authentication
MIT License
231 stars 59 forks source link

Unable to use migrations #30

Closed supernour09 closed 6 years ago

supernour09 commented 6 years ago

Hi i was trying to "enable-migrations" i got this error

`Exception calling "SetData" with "2" argument(s): "Type 'Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAProject' in assembly 'Microsoft.VisualStudio.ProjectSystem.VS.Implementation, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable." At C:\Users\Nour Ahmed.nuget\packages\entityframework\6.2.0\tools\EntityFramework.psm1:720 char:5

Exception calling "SetData" with "2" argument(s): "Type 'Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAProject' in assembly 'Microsoft.VisualStudio.ProjectSystem.VS.Implementation, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable." At C:\Users\Nour Ahmed.nuget\packages\entityframework\6.2.0\tools\EntityFramework.psm1:721 char:5

Exception calling "SetData" with "2" argument(s): "Type 'Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAProject' in assembly 'Microsoft.VisualStudio.ProjectSystem.VS.Implementation, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable." At C:\Users\Nour Ahmed.nuget\packages\entityframework\6.2.0\tools\EntityFramework.psm1:722 char:5

System.NullReferenceException: Object reference not set to an instance of an object. at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetPropertyValue[T](Project project, String propertyName) at System.Data.Entity.Migrations.MigrationsDomainCommand.GetFacade(String configurationTypeName, Boolean useContextWorkingDirectory) at System.Data.Entity.Migrations.EnableMigrationsCommand.FindContextToEnable(String contextTypeName) at System.Data.Entity.Migrations.EnableMigrationsCommand.<>cDisplayClass2.<.ctor>b0() at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command) Object reference not set to an instance of an object.`

any work around for it

robisim74 commented 6 years ago

@supernour09

This project uses .NET Core and EF Core.

In EF Core there isn't an enable-migrations command.

You can use the following commands:

dotnet ef migrations add [Name] -o Data/Migrations
dotnet ef database update

For more info, please refer to the offcial docs: https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/dotnet

Greetings