XGG
XGG

Reputation: 51

How do I make migrations in Entity Framework?

My research keeps telling me to use the Migrate.exe, which has not shown up in my project, and it cannot be downloaded anywhere. I am also using VS Code and not Visual Studio, which seems to make it impossible to use the Package Manager Console.

And I am using Entity Framework - not Entity Framework Core - so I do not have all the options of EFC.

Currently I am trying to set Entity Framework up in Unity, the game engine. It was possible to set up a temporary project with Entity Framework v6.2.0 and run dotnet pack to get the EntityFramework.dll but it does not create the Migrate.exe. And it seems to be the only option for creating migrations.

Do any of you know how to get the Migrate.exe file or another way to add migrations?

Upvotes: 1

Views: 140

Answers (2)

XGG
XGG

Reputation: 51

Apparently there is a difference in installing and adding, not that they mention that when you look at the package on nuget.org.

So rather than running dotnet add package EntityFramework --version 6.2.0 I needed to download the latest nuget.exe from nuget.org and create a packages.config file in the root folder.

I then ran nuget.exe install packages.config -OutputDirectory packages which installed all the files I needed.

packages.config:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="EntityFramework" version="6.2.0" targetFramework="net40" />
</packages>

Upvotes: 0

Arham Anees
Arham Anees

Reputation: 170

When you install Entity Framework using NuGet migrate.exe will be inside the tools folder of the downloaded package. In \packages\EntityFramework.\tools

Source is microsoft

have you tried this?

Upvotes: 2

Related Questions