nuke-build / nuke

🏗 The AKEless Build System for C#/.NET
https://nuke.build
MIT License
2.93k stars 357 forks source link

dotnet-ef requirement and improper command line execution #1419

Open BrewingCoder opened 3 weeks ago

BrewingCoder commented 3 weeks ago

Usage Information

.net 8 / Nuke 8.1.0 / EF 8.0.8

Description

All builds that called EntityFrameworkTasks.* fail, these worked previously by calling "dotnet ef" Nuke requests dotnet-ef package be installed used Nuke :addpackage to add requested version of dotnet-ef Nuke then runs the command C:\Program Files\dotnet\dotnet.exe" C:\Users\LocalUser\.nuget\packages\dotnet-ef\8.0.8\tools\net8.0\any\dotnet-ef.dll ef database drop --force --context AppDbContext --project mh3.Data --startup-project mh3.Web --no-build

That command is invalid

Reproduction Steps

add EntityFrameworkTasks.EntityFrameworkDatabaseDrop Task. Have Nuke fail because dotnet-ef not installed use AddPackage to add dotnet-ef to build project Have nuke task fail because command incorrectly generated

Expected Behavior

go back to either using "dotnet ef" or fix dotnet-ef command generation. related to #1213

Actual Behavior

build fails:


NUKE Execution Engine version 8.1.0 (Windows,.NETCoreApp,Version=v8.0)
​
​
╬═══════════════════
║ DatabaseDelete
╬══════════
​
00:45:33 [INF] About to Delete Application Database!
00:45:33 [INF] > "C:\Program Files\dotnet\dotnet.exe" C:\Users\*********\.nuget\packages\dotnet-ef\8.0.8\tools\net8.0\any\dotnet-ef.dll ef database drop --force --context AppDbContext --project mh3.Data --startup-project mh3.Web --no-build
00:45:36 [DBG] Specify --help for a list of available options and commands.
00:45:36 [DBG] Unrecognized command or argument 'ef'
00:45:36 [ERR] Target DatabaseDelete has thrown an exception
Nuke.Common.Tooling.ProcessException: Process 'dotnet.exe' exited with code 1.
   > "C:\Program Files\dotnet\dotnet.exe" C:\Users\********\.nuget\packages\dotnet-ef\8.0.8\tools\net8.0\any\dotnet-ef.dll ef database drop --force --context AppDbContext --project mh3.Data --startup-project mh3.Web --no-build
   @ C:\Data\Code\mh3
Standard output:
   Specify --help for a list of available options and commands.
   Unrecognized command or argument 'ef'

   at Nuke.Common.Tooling.ProcessExtensions.AssertZeroExitCode(IProcess process) in /_/source/Nuke.Tooling/ProcessExtensions.cs:line 39
   at Nuke.Common.Tooling.ProcessTasks.DefaultExitHandler(ToolSettings toolSettings, IProcess process) in /_/source/Nuke.Tooling/ProcessTasks.cs:line 257
   at Nuke.Common.Tools.EntityFramework.EntityFrameworkTasks.EntityFrameworkDatabaseDrop(EntityFrameworkDatabaseDropSettings toolSettings) in /_/source/Nuke.Common/Tools/EntityFramework/EntityFramework.Generated.cs:line 75
   at Nuke.Common.Tools.EntityFramework.EntityFrameworkTasks.EntityFrameworkDatabaseDrop(Configure`1 configurator) in /_/source/Nuke.Common/Tools/EntityFramework/EntityFramework.Generated.cs:line 102
   at AppDataTasks.DatabaseDelete() in C:\Data\Code\mh3\mh3.build\AppDataTasks.cs:line 7
   at Build.<>c.<get_DatabaseDelete>b__5_1() in C:\Data\Code\mh3\mh3.build\Build.cs:line 38
   at Nuke.Common.Execution.BuildExecutor.<>c.<Execute>b__4_2(Action x) in /_/source/Nuke.Build/Execution/BuildExecutor.cs:line 120
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at Nuke.Common.Execution.BuildExecutor.Execute(NukeBuild build, ExecutableTarget target, IReadOnlyCollection`1 previouslyExecutedTargets, Boolean failureMode) in /_/source/Nuke.Build/Execution/BuildExecutor.cs:line 120
​```

### Regression?

Yes, worked in previous release.

### Known Workarounds

_No response_

### Could you help with a pull-request?

No
BrewingCoder commented 3 weeks ago

Task code that generates error, model and context in different assemblies so Project/Startup Project parameters required

EntityFrameworkTasks.EntityFrameworkDatabaseDrop(s => s
    .SetProject("mh3.Data")
    .SetContext("AppDbContext")
    .SetStartupProject("mh3.Web")
    .SetNoBuild(true)
    .SetForce(true)
);