Aspnetcore.docs: No executable found matching command "dotnet-aspnet-codegenerator"

Created on 12 Jun 2018  Â·  19Comments  Â·  Source: dotnet/AspNetCore.Docs

After adding package Microsoft.VisualStudio.Web.CodeGeneration.Design I still get error message.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Source - Docs.ms

Most helpful comment

@bricelam is MacOS the only platform you need to explicitly dotnet tool install --global dotnet-aspnet-codegenerator

All 19 comments

You need .NET SDK 2.1

I forgot to add the DotNetCliToolReference element to csproj.

No executable found matching command "dotnet-aspnet-codegenerator" I got this error !!

Install the latest version of the .NET Core SDK But not the preview version.
It's no longer a <DotNetCliToolReference/> element.
It's a global tool.

Follow this link
https://stackoverflow.com/questions/51128038/no-executable-found-matching-command-dotnet-aspnet-codegenerator-asp-net-core

On Mon, Sep 17, 2018 at 4:41 PM Mohammad Touhidul Islam <
[email protected]> wrote:

No executable found matching command "dotnet-aspnet-codegenerator" I got
this error !!

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/aspnet/Docs/issues/6999#issuecomment-421967509, or mute
the thread
https://github.com/notifications/unsubscribe-auth/Ahierr0-AI9WtblqyUa_ARp0lT8f7U2Fks5ub3_jgaJpZM4Uktrz
.

@bricelam is MacOS the only platform you need to explicitly dotnet tool install --global dotnet-aspnet-codegenerator

No idea. The aspnet/Scaffolding folks own that tool.

dotnet tool install --global dotnet-aspnet-codegenerator works also on Windows for me! Could'nt install it via nuget neither by adding an item group to the .csproj file.

Thanks @Rick-Anderson

I was able to reproduce the same issue on Linux/VSCode and Linux/dotnet CLI. My current setup gives pretty confusing results:

dot_sent@sergey-pc:~/Projects/MVCTest/MvcIdentity$ dotnet tool install --global dotnet-aspnet-codegenerator
Tool 'dotnet-aspnet-codegenerator' is already installed.
dot_sent@sergey-pc:~/Projects/MVCTest/MvcIdentity$ dotnet aspnet-codegenerator --help
No executable found matching command "dotnet-aspnet-codegenerator"

dotnet --info output, in case it helps:

dot_sent@sergey-pc:~/Projects/MVCTest/MvcIdentity$ dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   2.1.504
 Commit:    91e160c7f0

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  16.04
 OS Platform: Linux
 RID:         ubuntu.16.04-x64
 Base Path:   /usr/share/dotnet/sdk/2.1.504/

Host (useful for support):
  Version: 2.1.8
  Commit:  209f8aa25c

.NET Core SDKs installed:
  2.1.101 [/usr/share/dotnet/sdk]
  2.1.504 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.6 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

@dot-sent can you open an issue at https://github.com/dotnet/cli/issues/new

@dot-sent install the latest SDK first, 2.2

@Rick-Anderson Done, still the same problem. Tried also uninstalling 2.0 and 2.1, reinstalling the aspnet-codegenerator - all to no avail. Finally installing it in a specific directory and running it via absolute path worked well. I guess some paths were not registering properly. Should I still open the issue on dotnet-cli?

dotnet --version
2.2.103

dotnet tool install --global dotnet-aspnet-codegenerator

~/.dotnet/tools/dotnet-aspnet-codegenerator -h

dotnet tool install --global dotnet-aspnet-codegenerator worked on Ubuntu too.

@JwanKhalaf It worked for me on Windows 10. Thanks a lot!

I just typed:
~/.dotnet/tools/dotnet-aspnet-codegenerator razorpage -m Movie -dc RazorPagesMovieContext -udl -outDir Pages/Movies --referenceScriptLibraries

So, I did not start with 'dotnet'.

I just typed:
~/.dotnet/tools/dotnet-aspnet-codegenerator razorpage -m Movie -dc RazorPagesMovieContext -udl -outDir Pages/Movies --referenceScriptLibraries

So, I did not start with 'dotnet'.

Alright, thanks @rlassche that worked for me. I have no clue why this solves it. can someone explains this issue?

I checked this issue again. This looks better:

  1. My PATH on Linux was not correct.
    export PATH=~/.dotnet/tools:$PATH
  2. The command in tools directory is called dotnet-aspnet-codegenerator and exists now in the PATH.
  3. Test it with dotnet now:
    $ dotnet aspnet-codegenerator
    The help-text is displayed.
Was this page helpful?
0 / 5 - 0 ratings

Related issues

danroth27 picture danroth27  Â·  3Comments

serpent5 picture serpent5  Â·  3Comments

AnthonyMastrean picture AnthonyMastrean  Â·  3Comments

Raghumu picture Raghumu  Â·  3Comments

cocowalla picture cocowalla  Â·  3Comments