Install Entity Framework as a Global Tool
Published: December 14, 2025
When working with Entity Framework Core, sooner or later you’ll need to run commands to create migrations, update your database schema, or scaffold models from an existing database. That’s where the EF Core command-line tools come in. The EF tools aren’t included by default when you install the .NET SDK — they’re a separate global tool that you install once and use across all your projects.
The command to install the Entity Framework global tool is simple:
dotnet tool install --global dotnet-ef
Once installed, the dotnet ef command becomes available in your terminal from any directory. This tool gives you access to powerful commands for managing your database and models during development.
What is the EF Global Tool?
The dotnet-ef global tool is a command-line interface (CLI) for Entity Framework Core. It provides commands that handle database schema changes, generate migration files, apply migrations to databases, and even reverse-engineer models from existing databases. It’s a must-have for any developer working with Entity Framework Core in .NET projects.
When you run dotnet tool install --global dotnet-ef, the .NET SDK downloads and installs the tool into your global tools directory. The --global flag means it’s installed for your user account and accessible system-wide — you don’t need to reinstall it for each project.
Why is it Necessary?
Entity Framework Core manages your database schema through migrations. Migrations are code files that describe changes to your database schema over time — adding tables, columns, indexes, or modifying relationships. Without the EF tool, you can’t create or apply these migrations from the command line.
Here are some common tasks you’ll use dotnet ef for:
- Create migrations: When you change your model classes, you generate a migration to capture those changes:
dotnet ef migrations add InitialCreate - Update the database: Apply pending migrations to your development or test database:
dotnet ef database update - Scaffold from an existing database: Generate model classes and a DbContext from an existing database (database-first approach):
dotnet ef dbcontext scaffold "ConnectionString" Microsoft.EntityFrameworkCore.SqlServer - Remove the last migration: If you need to undo a migration you just added:
dotnet ef migrations remove
All of these commands require the dotnet-ef tool to be installed. If you try to run them without installing the tool first, you’ll get an error saying the command isn’t recognized.
Helpful for Your Workflow
Installing the EF global tool streamlines your development workflow. Whether you’re working in Visual Studio, VS Code, or from the command line, having dotnet ef available means you can quickly manage your database schema without switching contexts or relying on Visual Studio’s Package Manager Console.
It’s also essential if you’re setting up a new development machine or working in environments outside of Visual Studio. For example, if you’re coding on Linux or macOS, or using a lightweight editor like VS Code, the dotnet ef tool is how you manage Entity Framework tasks.
Another benefit: the global tool gets updated independently of the .NET SDK. When a new version of Entity Framework Core is released, you can update your global tools to get the latest features and bug fixes:
dotnet tool update --global dotnet-ef
Quick Setup
Installing the EF global tool is straightforward. Open your terminal and run:
dotnet tool install --global dotnet-ef
The installation takes just a few seconds. Once it’s complete, verify it’s installed by checking the version:
dotnet ef --version
You should see output showing the version of the EF tool installed. From that point forward, you have access to all the Entity Framework CLI commands on your machine.
Working with Multi-Project Solutions
In many real-world applications, your database context and entities are in a separate project from your startup project. For example, you might have a solution with separate projects for your API, database layer, and business logic. In these cases, you need to specify which project contains your DbContext and which project should be used for startup and configuration.
I use this pattern in my Blazor WASM and API Template project. The solution has a Database project that contains the entities and DbContext, while the API project handles startup and configuration (including the connection string in appsettings.json). When running EF commands, you need to tell the tool about both projects.
Here’s how you specify the database project and startup project when running EF commands:
Create a migration:
dotnet ef migrations add InitialCreate --project YourProject.Database --startup-project YourProject.API
Update the database:
dotnet ef database update --project YourProject.Database --startup-project YourProject.API
The --project option specifies where your DbContext and entities live (the database project), while --startup-project tells EF which project to use for configuration, dependency injection setup, and connection strings. Both are important — the database project knows your schema, but the startup project knows how to configure and connect to the database.
When you run these commands from the root of your solution, the tool finds both projects and uses them together. The startup project provides the configuration (like your connection string from appsettings.json), and the database project is where the migration files are created and stored.
This approach keeps your architecture clean and maintainable. Your database concerns stay in the database project, while your API or web app project handles configuration and hosting. The EF tool bridges the gap between them.
Wrapping Up
The dotnet-ef global tool is a small install with a big impact on your Entity Framework Core workflow. It’s the bridge between your code and your database during development — enabling you to create migrations, update schemas, and scaffold models with simple commands. If you’re working with EF Core, installing this tool is one of the first steps you should take on any new machine.
For more details on the EF Core command-line tools and all available commands, check out the official documentation: Entity Framework Core tools reference - .NET Core CLI
Make it happen!