Skip to content

Commands: Assembly-based Command Line Interface (ef.exe) #646

Closed

Description

@bricelam

Like dotnet-ef but with less project.json and more *.dll

A rudimentary version of this is available in the Microsoft.EntityFrameworkCore.Tools package (under the tools directory), but it is currently just an implementation detail of the PMC commands.

A few TODO items to make it generally useful:

Activity

  1. added this to the milestone on Sep 12, 2014
  2. changed the title [-][Beta Must Have] Migrations: Command Line Interface (ef.exe)[/-] [+]Migrations: Command Line Interface (ef.exe)[/+] on Sep 30, 2014
  3. modified the milestone: on Nov 25, 2014
  4. added this to the Backlog milestone on Nov 26, 2014
  5. changed the title [-]Migrations: Command Line Interface (ef.exe)[/-] [+]Migrations: Command Line Interface (ef.exe) a.k.a non-DNX non-VS CLI[/+] on Jul 24, 2015
  6. bricelam commented on Mar 8, 2016

    @bricelam
    ContributorAuthor

    We'll probably need a few different versions.

    Executable Description
    ef.clr AnyCPU, Full .NET
    ef.clr.x86 32-bit, Full .NET
    ef.coreclr CoreCLR

    We could probably have just an ef driver that is smart enough to delegate based on the assemblies passed in.

    With the driver, we could even hide the fact that there are multiple versions by packaging them into the driver and extracting them behind the scenes.

    I wonder if we could use the fact that .NET Core unifies on Full .NET to our advantage in the architecture... Something like a single "portable" assembly that we run via the appropriate CLR/CoreCLR host.

  7. changed the title [-]Migrations: Command Line Interface (ef.exe) a.k.a non-DNX non-VS CLI[/-] [+]Commands: Assembly-based Command Line Interface (ef.exe)[/+] on Mar 8, 2016
  8. modified the milestones: 1.1.0, Backlog on Aug 11, 2016
  9. 30 remaining items

  10. bricelam commented on Jan 12, 2017

    @bricelam
    ContributorAuthor

    We've decided to leave --assembly as a named parameter.

  11. bricelam commented on Jan 12, 2017

    @bricelam
    ContributorAuthor

    I believe it's ready for prime time. I've filed dotnet/EntityFramework.Docs#328 to document it.

  12. andycmaj commented on Jul 4, 2018

    @andycmaj

    hello... not understanding which versions --assembly is expected to work in...

    i'm trying to run migrations on a published dll and --assembly doesn't seem to fix the missing project error:

    (note that i'm using dotnet-ef.dll published along with my app because i added a PackageReference on <PackageReference Include="Microsoft.EntityFrameworkCored.Tools.DotNet" Version="2.1.0-preview1-final" />)

    root@82332f775c88:/app# dotnet exec --depsfile KanbanLab.FrontEnd.deps.json --runtimeconfig KanbanLab.FrontEnd.runtimeconfig.json Microsoft.EntityFrameworkCore.Design.dll database update --assembly KanbanLab.FrontEnd.dll --startup-assembly KanbanLab.FrontEnd.dll --verbose --context KanbanContext
    
    Unhandled Exception: System.MissingMethodException: Entry point not found in assembly 'Microsoft.EntityFrameworkCore.Design, Version=2.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
    Aborted
    root@82332f775c88:/app# dotnet exec --depsfile KanbanLab.FrontEnd.deps.json --runtimeconfig KanbanLab.FrontEnd.runtimeconfig.json dotnet-ef.dll database update --assembly KanbanLab.FrontEnd.dll --startup-assembly KanbanLab.FrontEnd.dll --verbose --context KanbanContext
    Microsoft.EntityFrameworkCore.Tools.CommandException: No project was found. Change the current working directory or use the --project option.
       at Microsoft.EntityFrameworkCore.Tools.RootCommand.FindProjects(String path, String errorWhenNoProject, String errorWhenMultipleProjects)
       at Microsoft.EntityFrameworkCore.Tools.RootCommand.Execute()
       at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
       at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)
    No project was found. Change the current working directory or use the --project option.
    root@82332f775c88:/app# dotnet exec --depsfile KanbanLab.FrontEnd.deps.json --runtimeconfig KanbanLab.FrontEnd.runtimeconfig.json dotnet-ef.dll --assembly KanbanLab.FrontEnd.dll --startup-assembly KanbanLab.FrontEnd.dll database update --verbose --context KanbanContext
    
                         _/\__
                   ---==/    \\
             ___  ___   |.    \|\
            | __|| __|  |  )   \\\
            | _| | _|   \_/ |  //|\\
            |___||_|       /   \\\/\\
    
    Entity Framework Core .NET Command-line Tools 2.1.0-preview1-28290
    
    Usage: dotnet ef [options] [command]
    
    Options:
      --version        Show version information
      -h|--help        Show help information
      -v|--verbose     Show verbose output.
      --no-color       Don't colorize output.
      --prefix-output  Prefix output with level.
    
    Commands:
      database    Commands to manage the database.
      dbcontext   Commands to manage DbContext types.
      migrations  Commands to manage migrations.
    
    Use "dotnet ef [command] --help" for more information about a command.
    root@82332f775c88:/app# ef
    bash: ef: command not found
    root@82332f775c88:/app# dotnet dotnet-ef.dll
    A fatal error was encountered. The library 'libhostpolicy.so' required to execute the application was not found in '/app/'.
    Failed to run as a self-contained app. If this should be a framework-dependent app, add the /app/dotnet-ef.runtimeconfig.json file specifying the appropriate framework.
    root@82332f775c88:/app# dotnet exec --depsfile KanbanLab.FrontEnd.deps.json --runtimeconfig KanbanLab.FrontEnd.runtimeconfig.json dotnet-ef.dll --assembly KanbanLab.FrontEnd.dll --startup-assembly KanbanLab.FrontEnd.dll database update --verbose --context KanbanContext
    
                         _/\__
                   ---==/    \\
             ___  ___   |.    \|\
            | __|| __|  |  )   \\\
            | _| | _|   \_/ |  //|\\
            |___||_|       /   \\\/\\
    
    Entity Framework Core .NET Command-line Tools 2.1.0-preview1-28290
    
    Usage: dotnet ef [options] [command]
    
    Options:
      --version        Show version information
      -h|--help        Show help information
      -v|--verbose     Show verbose output.
      --no-color       Don't colorize output.
      --prefix-output  Prefix output with level.
    
    Commands:
      database    Commands to manage the database.
      dbcontext   Commands to manage DbContext types.
      migrations  Commands to manage migrations.
    
    Use "dotnet ef [command] --help" for more information about a command.
  13. andycmaj commented on Jul 4, 2018

    @andycmaj

    ended up snatching ef.dll from the package cache during my builds...

        <PackageReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.1.0-preview1-final" />
        <Content CopyToPublishDirectory="PreserveNewest" Include="$(NuGetPackageRoot)microsoft.entityframeworkcore.tools.dotnet\2.1.0-preview1-final\tools\netcoreapp2.0\*.*" />
    

    so now i can publish with ef.dll and this seems to actually work for migrations, rather than dotnet-ef.dll

  14. added theissue type on Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions