dotnet / dotnet/AspNetCore.Docs

Package versions mismatch causes error

Open
#28,717 1 comment 0 reactions 1 assignee Claimed by @wadepickett View on GitHub
doc-idea Source - Docs.ms
Dominant language
C#
Stars
13.1k
Forks
24.6k
Avg merge
1d 2h
Merged PRs (30d)
109

Description

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

* ID: 6719f08e-3bd7-dc1a-71df-f2ef9fbca9d8
* Version Independent ID: 7096fdb3-612e-9e00-bd0b-8ea4886a09ce
* Content: [Part 2, add a model](https://learn.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/model?view=aspnetcore-6.0&tabs=visual-studio)
* Content Source: [aspnetcore/tutorials/razor-pages/model.md](https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/tutorials/razor-pages/model.md)
* Product: **aspnet-core**
* Technology: **aspnetcore-tutorials**
* GitHub Login: @wadepickett
* Microsoft Alias: **wpickett**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.