Opened by @drammons at https://github.com/dotnet/AspNetCore.Docs/issues/19785
Got to the generated scaffolding step. Ensured dotnet-aspnet-codegenerator was definitely installed. Tried both variants of the command mentioned in other issues (with and without the hyphen)
$ dotnet --version
3.1.401
$dotnet tool update -g Dotnet-aspnet-codegenerator
Tool 'dotnet-aspnet-codegenerator' was reinstalled with the latest stable version (version '3.1.4').
$dotnet-aspnet-codegenerator controller -name TodoItemsController -async -api -m TodoItem -dc TodoContext -outDir Controllers
dotnet-aspnet-codegenerator: command not found
$ dotnet aspnet-codegenerator controller -name TodoItemsController -async -api -m TodoItem -dc TodoContext -outDir Controllers
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-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.
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Hi,
Is this on linux or mac?
Seems like the tool is not even being detected here, I would suggest restarting the terminal you are using since the tool might not have registered.
Mac. Catalina. I tried restarting the terminal. No change. Anything else I can send you? I'm just trying to walk through a tutorial.
Is the tool installed at the below location. Reference
OS | Path
-- | --
Linux/macOS | $HOME/.dotnet/tools
Windows | %USERPROFILE%.dotnet\tools
I noticed you installed it with a capital D have you tried
dotnetcli
Dotnet-aspnet-codegenerator controller -name TodoItemsController -async -api -m TodoItem -dc TodoContext -outDir Controllers
Also has uninstalling and reinstalling worked
dotnet tool uninstall --global dotnet-aspnet-codegenerator
dotnet tool install --global dotnet-aspnet-codegenerator
David-MBP:TodoApi drammons$ Dotnet-aspnet-codegenerator controller -name TodoItemsController -async -api -m TodoItem -dc TodoContext -outDir Controllers
-bash: Dotnet-aspnet-codegenerator: command not found
David-MBP:TodoApi drammons$ Dotnet aspnet-codegenerator controller -name TodoItemsController -async -api -m TodoItem -dc TodoContext -outDir Controllers
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-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.
David-MBP:TodoApi drammons$ dotnet tool uninstall --global dotnet-aspnet-codegenerator
Tool 'dotnet-aspnet-codegenerator' (version '3.1.4') was successfully uninstalled.
David-MBP:TodoApi drammons$ dotnet tool install --global dotnet-aspnet-codegenerator
Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed.
You can invoke the tool using the following command: dotnet-aspnet-codegenerator
Tool 'dotnet-aspnet-codegenerator' (version '3.1.4') was successfully installed.
David-MBP:TodoApi drammons$ dotnet aspnet-codegenerator controller -name TodoItemsController -async -api -m
TodoItem -dc TodoContext -outDir Controllers
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-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.
Uninstall with this comand:
dotnet tool uninstall --global dotnet-aspnet-codegenerator
Then reinstall with this command:
dotnet tool install --global dotnet-aspnet-codegenerator
When you uninstall, It should give you some commands that will help export the path should it not already be in your path for the zsh shell. In other words, it most likely isn't in the zsh path and you need to do an export command script in the shell from the current .dotnet/tools directory.
Worked like a charm. Thanks
I think there is an extra unnecessary '-' on the guidance. It worked for me just using dotnet aspnet-codegenerator
Most helpful comment
I think there is an extra unnecessary '-' on the guidance. It worked for me just using
dotnet aspnet-codegenerator