I'm learning ASP.net, so I'm reading https://learn.microsoft.com/fr-fr/aspnet/core/tutorials/razor-pages/model?view=aspnetcore-3.0&tabs=visual-studio-code and in the section Scaffold the movie model, I must install and run the CRUD tool (ASP.net Core dotnet-aspnet-codegenerator). The problem I encounter is I can't use their tool, an error is output ; however I could install it. Below are the details.
So I'm following the three-steps tutorial to use this CRUD code generator (link given above). I quote:
- Open a command window in the project directory (The directory that contains the Program.cs, Startup.cs, and .csproj files).
✔ It worked.
- Install the scaffolding tool:
dotnet tool install --global dotnet-aspnet-codegenerator
✔ It worked and now if I try to re-install it, it outputs that it's already installed.
- For macOS and Linux: Run the following command:
dotnet aspnet-codegenerator razorpage -m Movie -dc RazorPagesMovieContext -udl -outDir Pages/Movies --referenceScriptLibraries
🐛 It doesn't work. Here is the output error:
Could not execute because the specified command or file was not found. Possible reasons for this include: * You misspelled a built-in dotnet command. * You intended to execute a .NET Core program, but dotnet-dotnet-aspnet-codegenerator does not exist. * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
Question : How can I debug it to make this command work?
export PATH=$HOME/.dotnet/tools:$PATH
was needed, as indicated for Core MVC (https://learn.microsoft.com/fr-fr/aspnet/core/tutorials/first-mvc-app/adding-model?view=aspnetcore-3.0&tabs=visual-studio-code). This indication was forgotten for Core Razor . . .