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

Package versions mismatch causes error #28717

Open alexbrave opened 1 year ago

alexbrave commented 1 year ago

If there is a mismatch between the version number of Microsoft.EntityFrameworkCore.Design (in my case 7.0.4) that the user installs as part of the tutorial and Microsoft.VisualStudio.Web.CodeGeneration.Design (in my case 6.0.13) that is installed as part of Visual studio, the user will get an error saying: There was an error running the selected code generator: 'Install the package Microsoft.VisualStudio.Web.CodeGeneration.Design and try again.'

It seems that this can occur in cases where a user may have had VS installed for a little while, and the latest stable version of Microsoft.EntityFrameworkCore.Design has moved one (or maybe more) major version ahead of the Microsoft.VisualStudio.Web.CodeGeneration.Design that seems to be pre-installed. In my case one of the packages was on version 6 and the other I installed version 7

The error is confusing because it implies that Microsoft.VisualStudio.Web.CodeGeneration.Design is not installed at all, so when the user checks and sees that this package is installed, they will likely not immediately spot the issue of version mismatches.

Alternatively the error may have occurred for some other reason that I wasn't able to identify, and was resolved when I made the package major versions match (downgrading Microsoft.EntityFrameworkCore.Design to match the major version in the tutorial, which is 6), so the description above is my best guess as to what the error was and how my solution solved that error.


Document Details

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

Rick-Anderson commented 1 year ago

Make sure you have the SDK installed for the major version you're targeting.