Error NU1107 Version conflict detected for Microsoft.CodeAnalysis.Common. Install/reference Microsoft.CodeAnalysis.Common 3.8.0 directly to project Name to resolve this issue

Question: How do you resolve the error that says "Severity Code Description Project File Line Suppression State Error NU1107 Version conflict detected for Microsoft.CodeAnalysis.Common. Install/reference Microsoft.CodeAnalysis.Common 3.8.0 directly to project ProjectName to resolve this issue. ProjectName -> Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation 5.0.1 -> Microsoft.CodeAnalysis.Razor 5.0.1 -> Microsoft.CodeAnalysis.Common (>= 3.8.0) 
 ProjectName -> Microsoft.VisualStudio.Web.CodeGeneration.Design 5.0.0 -> Microsoft.VisualStudio.Web.CodeGenerators.Mvc 5.0.0 -> Microsoft.VisualStudio.Web.CodeGeneration 5.0.0 -> Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore 5.0.0 -> Microsoft.VisualStudio.Web.CodeGeneration.Core 5.0.0 -> Microsoft.VisualStudio.Web.CodeGeneration.Templating 5.0.0 -> Microsoft.VisualStudio.Web.CodeGeneration.Utils 5.0.0 -> Microsoft.CodeAnalysis.CSharp.Workspaces 3.7.0 -> Microsoft.CodeAnalysis.Common (= 3.7.0). PathToTheProject.csproj 1 

Suggested Login to See the Rest of the Answer

This error tells you that there is a version conflict detected. It goes on to show you where exactly is that error. It'>#bfedd2;">It is most likely that you have unknown version number in one of your package references in the csproj file.

In this case the package that had a wrong version was Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation of version 5.0.1 looking around there is no build with the version 5.0.1. Therefore, downgrading the version number to 5.0.0 fixes the issue.

  <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="5.0.0" />

© 2023 - ErnesTech - Privacy