问题
Unable to generate scaffolding using aspnet-codegenerator, below is what I tried:
Created an ASP.Net RazorPages application using
dotnet new webapp
Did a
dotnet build
Installed dotnet-aspnet-codegenerator using
dotnet tool install --global dotnet-aspnet-codegenerator --version 3.1.4
Ran
dotnet aspnet-codegenerator --help
It says: No code generators are available in this project.Add Microsoft.VisualStudio.Web.CodeGeneration.Design package to the project as a NuGet package reference.
Added the package mentioned in step 4 using
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
Package added is:
<ItemGroup> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" /> </ItemGroup>
Again ran:
dotnet build
Final-Step
Ran
dotnet aspnet-codegenerator --help
Again it says: No code generators are available in this project.Add Microsoft.VisualStudio.Web.CodeGeneration.Design package to the project as a NuGet package reference.
.Net core installed version: 3.1.401
Os: Ubuntu 20.04
回答1:
I test your command,and when I do this dotnet tool install --global dotnet-aspnet-codegenerator --version 3.1.4
,I can get
and then Ran dotnet aspnet-codegenerator --help
,I get the same message No code generators are available in this project.Add Microsoft.VisualStudio.Web.CodeGeneration.Design package to the project as a NuGet
with you,
but when I do the following,I can run without the message:
I think maybe the package is not added correctly,you can try to remove and add it again.
dotnet remove package Microsoft.VisualStudio.Web.CodeGeneration.Design
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
回答2:
This is already a few month old, but I ran into it recently for all my projects.
In case someone else lands on this page, the solution in my case(MAC OS), was to uninstall and reinstall dotnet-aspnet-codegenerator.
Run in terminal:
dotnet tool uninstall --global dotnet-aspnet-codegenerator
dotnet tool install --global dotnet-aspnet-codegenerator --version 3.1.4
回答3:
I have found the SOLUTION to this issue:
The newest versions are giving some problems, so you will have to downgrade the version of the sdk to the 3.1.3 by writing this command on the terminal:
sudo apt install dotnet-sdk-3.1=3.1.301-1
After that you will need to install the following:
dotnet tool install --global dotnet-aspnet-codegenerator --version 3.1.3
After that you will need to add the right Web.CodeGeneration.Design Package by writing this on the terminal:
sudo apt install dotnet-sdk-3.1=3.1.301-1 dotnet tool install --global dotnet-aspnet-codegenerator --version 3.1.3
That has worked for me!!
来源:https://stackoverflow.com/questions/63584060/aspnet-codegenerator-no-code-generators-available-even-after-adding-microsoft