question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dotnet ef6 (Migrations commands on projects without Visual Studio)

See original GitHub issue

In EF Core, we introduced dotnet ef which enabled Migrations commands (Add-Migration, Update-Database, etc.) outside of Visual Studio and on other platforms like macOS and Linux.

As part of #231, we introduced the underlying ef6 command which is cross-platform but works directly with assemblies instead of project files (csproj, vbproj, etc). For example, the equivalent of Update-Database would be…

dotnet exec \
  --depsfile ./bin/Debug/netcoreapp3.0/MyApp.deps.json \
  --runtimeconfig ./bin/Debug/netcoreapp3.0/MyApp.runtimeconfig.json \
  ~/.nuget/packages/entityframework/6.3.0/tools/netcoreapp3.0/any/ef6.dll \
  --assembly ./bin/Debug/netcoreapp3.0/MyApp.dll \
  database update

Obviously, this isn’t very user friendly compared to a simple dotnet ef6 database update, but it is possible. You can also get the exact command to run by adding -Verbose to the PMC commands since they are also backed by this same underlying command.

Is this enough or should we introduce dotnet ef6? How many EF6 projects will be developed without using Visual Studio?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:55
  • Comments:41 (12 by maintainers)

github_iconTop GitHub Comments

18reactions
marchycommented, Sep 6, 2019

@ErikEJ this has nothing to do with Migrator.EF6.

This is a basic functionality of making ANY mutations to your data model, and Microsoft shouldn’t be relying on third parties to deliver mission-critical parts of their own frameworks/platforms.

We literally can’t add a column to our domain models without spinning up a Windows VM, developing in a duplicated repo/IDE and have been in this state of affairs for the past 2+ years. We’ve tried everything from buying multiple machines to deal with this, running boot partitions, and now slow and resource-eating VMs. We’ve exerted all sorts of needless engineering efforts for this, from splitting our servers into needlessly-isolated micro-services to reduce the impact of how many projects have to be stuck on .NET Framework/Windows environments, to forking and debugging 3rd party stop-gap solutions like Migrator.EF6 – let alone adopting and then fully-downgrading from EF Core due to the ridiculous unreadiness on that front that’s been the case along this whole journey (#side-vent).

The point is that .NET Core is ALL about running in non-Windows environments (read the mission/purpose) – literally ‘cross-platform’ and ‘command-line tools’ are two of the main stated goals lol

Quit defending the complete ball-drop on this. This needs to be resolved ASAP and without expecting the community to do Microsoft’s own internal development. Your defense/work-around mindset for this is only feeding the problem.

18reactions
tocsoftcommented, Aug 16, 2019

Seems a shame that dotnet-ef couldn’t just detect the correct entity framework version in play and execute the command against the correct ef backend underneath for you (even if it has to call dotnet build in the process to get hold of the latest dlls etc). Would be much better user experience instead of adding in a whole new tool with its additional cognitive load of a having to know/learn another new tool.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Run Migrations command if not have visual studio
Find migrate.exe (YourApp\packages\EntityFramework.6.1.3\tools) and paste it in bin folder on the server. Open Command Prompt on the server.
Read more >
Using a Separate Migrations Project - EF Core
Using a separate migration project for managing database schemas with Entity Framework Core.
Read more >
Managing Migrations - EF Core
To manage migrations, you must first install the EF Core command-line tools. Tip. If the DbContext is in a different assembly than the...
Read more >
EF Core tools reference (.NET CLI)
Provides tab completion of commands, parameters, project names, context types, and migration names. Installing the tools. dotnet ef can be ...
Read more >
Migrations Overview - EF Core
Overview of using migrations to manage database schemas with Entity Framework Core.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found