aspnet-codegenerator: No code generators available, Even after adding Microsoft.VisualStudio.Web.CodeGeneration.Design

六月ゝ 毕业季﹏ 提交于 2020-12-08 13:37:41

问题


Unable to generate scaffolding using aspnet-codegenerator, below is what I tried:

  1. Created an ASP.Net RazorPages application using dotnet new webapp

  2. Did a dotnet build

  3. Installed dotnet-aspnet-codegenerator using

    dotnet tool install --global dotnet-aspnet-codegenerator --version 3.1.4

  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.

  5. 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>

  6. Again ran: dotnet build

    Final-Step

  7. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!