Alan B
Alan B

Reputation: 2299

EF Core to use NUGET Package Manager Console or CMD

I am trying to add initial migration using EF Core. I am not sure which one to use OR when I should be using the below. I am using EF core 1.1

dotnet ef migration add init (using window console)

OR

add-migration init (using Nuget Console)

I have been using Nuget Package Manager Console in the past (EF 6) for migration.

I also noticed that both are being used for EF Core but I am not sure for which .NET framework (.NET Core) version the above commands are valid.

regards, Alan

Upvotes: 2

Views: 1200

Answers (2)

bricelam
bricelam

Reputation: 30405

As Martin said, you can use either. The dotnet ef command even works in PMC if you cd to the project first. There is even a third command: ef.exe that can be found in the NuGet package.

Here is an explanation of what each one gives you: (in "ascending" order)

  • ef.exe--Operates on raw assemblies. You tell it project info.
  • dotnet ef--Operates on *.csproj files (using MSBuild). Infers project info. Calls ef.exe
  • PMC Tools--Operates on Visual Studio projects (using EnvDTE). Infers project info. Detects the startup project. Opens files in the IDE. Has tab-expansion for command arguments. Calls ef.exe

So, to get the best experience, use the PMC Tools (i.e. Add-Migration, etc.) if you can.

Upvotes: 6

Martin Fletcher
Martin Fletcher

Reputation: 168

You can use either.

Personally, I like to use the NuGet console, as I dont have to leave Visual Studio. The PowerShell commands from NuGet console simple run the dotnet.exe commands under the hood anyway - They are just syntactic sugar :)

Upvotes: 2

Related Questions