-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Commands: Assembly-based Command Line Interface (ef.exe) #646
Comments
We'll probably need a few different versions.
We could probably have just an 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. |
(Pulling this into |
Issues: - Fix #646 - implements assembly-based command line interface - Fix #5273 - Split tools packages into .Tools.DotNet and .Tools.VisualStudio - Fix #5334 - Refactor cmdlets/dotnet-ef to invoke ef.exe/ef.dll - Fix #5684 - Use nuspec's instead of Sake - Fix #5839 - throw warning when architecture is not in {x86, x64, AnyCPU} Other changes: - Add --no-color and --no-appdomain to command line tools - Add --json option to 'dbcontext scaffold' and 'migrations remove' - Refactor the inside-man invocation for Tools.DotNet to use "ef.dll" instead of invoking .Design.exe. - Add native powershell module for processing/forwarding streams - Reorganize code * 💔 break up DotNet and VisualStudio command line tools into separate packages * Push down execution logic dode from Tools.VisualStudio into .Design. * Lift code from .Design.Core to .Design * Reorganize test projects * Create a powershell only project for Tools.VisualStudio * Move tests into appropriate test projects and adjust namespaces
# Current
ef migration list --assembly WebApplication1.exe
# Possible
ef migrations list WebApplication1.exe
ef database update WebApplication1.exe Migration7 Or is it too awkward when combined with sub-commands and other positional arguments? |
We've decided to leave |
I believe it's ready for prime time. I've filed dotnet/EntityFramework.Docs#328 to document it. |
hello... not understanding which versions i'm trying to run migrations on a published dll and (note that i'm using 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. |
ended up snatching
so now i can publish with |
Like
dotnet-ef
but with lessproject.json
and more*.dll
A rudimentary version of this is available in the
Microsoft.EntityFrameworkCore.Tools
package (under thetools
directory), but it is currently just an implementation detail of the PMC commands.A few TODO items to make it generally useful:
Don't output ANSI escape codes(covered by Tools: Console color broken #6962)--assembly
,--startup-assembly
, and the working directoryFix argument parsing quirks(covered by Commands: Better argument parsing #6593)Improve the experience of running it on a server(covered by Improve user experience for running migrations after deployment #6313)The text was updated successfully, but these errors were encountered: