dotnet / AspNetCore.Docs

Documentation for ASP.NET Core
https://docs.microsoft.com/aspnet/core
Creative Commons Attribution 4.0 International
12.63k stars 25.29k forks source link

Need to install Microsoft.EntityFrameworkCore.Tools to scaffold controller and views #28637

Closed yosuaputra1 closed 1 year ago

yosuaputra1 commented 1 year ago

I'm following the tutorial here https://learn.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/model using my Mac. But when I ran the command to scaffold CRUD operations for the Movie model, I got the following messages in the terminal:

To scaffold controllers and views using models, install Entity Framework core packages and try again: Microsoft.EntityFrameworkCore.Tools

So I run this command to add the package: dotnet add package Microsoft.EntityFrameworkCore.Tools

Now the error is gone and I managed to scaffold it.

So maybe this section https://learn.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/model?view=aspnetcore-7.0&tabs=visual-studio-code#add-nuget-packages-and-ef-tools needs to be updated to add this package?


Document Details

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

Rick-Anderson commented 1 year ago

@wadepickett make sure I review any fix to this PR.

wadepickett commented 1 year ago

Tested the tutorial on VS Code on Mac. I cannot replicate the issue, it runs as expected with all tools and packages accounted for. However, in the step for running the commands to install the required tools and packages, the very last command is for adding Micorosoft.EntityFrameworkCore.Tools. Since it takes some time for the first 8 commands to run, it can be easy to miss hitting return to ensure the very last command runs and Tools is installed, all the rest run as they are pasted in. I suspect that may be what occurred.