Scaffold Error with API Controller with actions, using Entity Framework on .NET 9.0

When I try to add a scaffolded file that is of type API Controller with actions, using Entity Framework on .NET 9.0 I get an error of  * Scaffold item command has finished with error: Unrecognized option '--useSqlite'
 

Here is the log rider shows me:

Start checking required NuGet packages...
Checking 'Microsoft.EntityFrameworkCore.Sqlite' NuGet Package...
Checking 'Microsoft.EntityFrameworkCore.SqlServer' NuGet Package...
Checking 'Microsoft.EntityFrameworkCore.Tools' NuGet Package...
Checking 'Microsoft.VisualStudio.Web.CodeGeneration.Design' NuGet Package...
Building project 'TodoApi'...
Check and install Code Generation tool...
Start scaffolding 'ApiControllerEntityFramework'...
Running command: /Users/[NAME]/Repos/TodoApi/obj/dotnet-aspnet-codegenerator --project /Users/[NAME]/Repos/TodoApi/TodoApi.csproj --target-framework net9.0 --configuration "Debug" --no-build controller --controllerName TodoController --relativeFolderPath "/Users/[NAME]/Repos/TodoApi/Controllers" --restWithNoViews --model TodoApi.Models.TodoItem --dataContext TodoApi.Models.TodoContext --controllerNamespace TodoApi.Controllers --useSqlite
Finding the generator 'controller'...
Running the generator 'controller'...
Specify --help for a list of available options and commands.
Unrecognized option '--useSqlite'
   at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.HandleUnexpectedArg(CommandLineApplication command, String[] args, Int32 index, String argTypeName, Boolean ignoreContinueAfterUnexpectedArg)
   at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.Execute(String[] args)
   at Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execute(String[] args)
RunTime 00:00:01.10
Scaffolding 'ApiControllerEntityFramework' has finished with errors:
 * Scaffold item command has finished with error: Unrecognized option '--useSqlite'
0
3 comments

Hello Marios, 

Thank you for contacting Rider support. Unfortunately, you encountered a known issue: 

  • RIDER-88316 Error when creating scaffolded api controller;

We would appreciate it if you could upvote it to demonstrate your interest;

As a workaround, you can copy the command line shown in Rider output, change --useSqlite in the end to --databaseProvider sqlite and invoke this manually from the terminal, for ex:

Running command: /Users/Dmitry.Kazantsev/RiderProjects/WebApplication1/AnotherRepro/obj/dotnet-aspnet-codegenerator --project /Users/Dmitry.Kazantsev/RiderProjects/WebApplication1/AnotherRepro/AnotherRepro.csproj --target-framework net9.0 --configuration "Debug" --no-build controller --controllerName ScaffoldedItemName --relativeFolderPath "/Users/Dmitry.Kazantsev/RiderProjects/WebApplication1/AnotherRepro" --restWithNoViews --model AnotherRepro.Model.Product --dataContext AnotherRepro.ApplicationDbContext --controllerNamespace AnotherRepro --databaseProvider sqlite

Hope that helps. Apologies for the inconvenience.

Have a nice day!

0

I’m trying that workaround, but being told I must install .NET to run this application. Which I’m pretty sure I already got.

username@machine ProjectTitle % /Users/username/Projects/HB/ProjectTitle/obj/dotnet-aspnet-codegenerator --project /Users/username/Projects/HB/ProjectTitle/ProjectTitle.csproj --target-framework net9.0 --configuration "Debug" --no-build controller --controllerName Job --relativeFolderPath "/Users/username/Projects/HB/ProjectTitle/Controllers" --model ProjectTitle.Models.ErrorViewModel --dataContext ProjectTitle.Data.ProjectTitleContext --referenceScriptLibraries --useDefaultLayout --controllerNamespace ProjectTitle.Controllers --databaseProvider sqlite

You must install .NET to run this application.

EDIT: I downgraded to dotnet 8.0 and got past the issue.
0
Hello Bobby,
I am glad to hear that a solution was found. Should you have any other questions or difficulties in the future, do not hesitate to contact support.
Have a nice day!
0

Please sign in to leave a comment.