Skip to content
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

EF Tools Migration Bundle Ignores --force option when specifying a output directory #33589

Open
geekywarrior opened this issue Apr 22, 2024 · 0 comments

Comments

@geekywarrior
Copy link

When building a Bundle to apply migrations to another machine, the force option fails to overwrite an existing bundle if you are specifying a custom output directory for the bundle.

dotnet ef migrations bundle -f --output "C:\PublishTestDirecory"

The bundle fails to build if an existing bundle exists

Building bundle...
System.IO.IOException: Cannot create a file when that file already exists.
   at System.IO.FileSystem.MoveFile(String sourceFullPath, String destFullPath, Boolean overwrite)
   at Microsoft.EntityFrameworkCore.Tools.Commands.MigrationsBundleCommand.Execute(String[] args)
   at Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.<>c__DisplayClass0_0.<Configure>b__0(String[] args)
   at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
   at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)
Cannot create a file when that file already exists.

Running the same option without an output directory works as expected with no errors

dotnet ef migrations bundle -f
Building bundle...
Done. Migrations Bundle: C:\PublishTestDirecory\efbundle.exe
Don't forget to copy appsettings.json alongside your bundle if you need it to apply migrations.

Include provider and version information

Entity Framework Core .NET Command-line Tools 8.0.4
EF Core version: 8.0.4
Database provider: (e.g. Pomelo.EntityFrameworkCore.MySql)
Target framework: (e.g. .NET 8.0)
Operating system: Windows
IDE: (e.g. Visual Studio 2022 17.9.6)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants