Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not install dotnet-aspnet-codegenerator tool

When I right click the controllers folder and select add, new scaffolding, empty MVC Controller, the ASP.NET Core Scaffolder gives me this error. I then added it to the project through the Nuget Manager and still have no luck. I am new to .NET and Visual Studio so any help is appreciated.

I am following this video tutorial to implement CRUD on asp.net MVC https://www.youtube.com/watch?v=C5cnZ-gZy2I

I've had similar issues in the past that were solved with adding something to my $PATH so here is the output of echo $PATH

/Users/raj/.gem/ruby/2.3.3/bin:/Users/raj/.rubies/ruby-2.3.3/lib/ruby/gems/2.3.0/bin:/Users/raj/.rubies/ruby-2.3.3/bin:/Users/raj/.rvm/gems/ruby-2.4.5/bin:/Users/raj/.rvm/gems/ruby-2.4.5@global/bin:/Users/raj/.rvm/rubies/ruby-2.4.5/bin:/usr/local/opt/[email protected]/sbin:/usr/local/opt/[email protected]/bin:/Users/raj/google-cloud-sdk/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:/opt/X11/bin:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Postgres.app/Contents/Versions/latest/bin:/Users/raj/.dotnet/tools:/Applications/Postgres.app/Contents/Versions/9.6/bin:/Users/raj/.rvm/bin

enter image description here

like image 999
Raj Singh Avatar asked Mar 02 '23 11:03

Raj Singh


2 Answers

When Visual Studio attempted to install "dotnet-aspnet-codegenerator" it would bomb because of the space located in the path "Google Drive". I moved the project to a directory with no spaces and it works fine.

like image 125
Raj Singh Avatar answered Mar 11 '23 14:03

Raj Singh


It worked for me:

  1. dotnet tool uninstall -g dotnet-aspnet-codegenerator
  2. dotnet tool install -g dotnet-aspnet-codegenerator

...and if it is still not working:

  1. Make sure your Project is in the default folder: /Users/yourname/Projects (in my case is MacOS).
like image 30
Ismael Silva Avatar answered Mar 11 '23 15:03

Ismael Silva