Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Version conflict detected for Microsoft.CodeAnalysis.Common. Reference the package directly from the project to resolve this issue

Ask Question

I want to add the FluentValidation Nuget package in my asp.net core app through Nuget Package Manager.While adding I get this error:

Severity Code Description Project File Line Suppression State Error Version conflict detected for Microsoft.CodeAnalysis.Common. Reference the package directly from the project to resolve this issue. Project Name -> FluentValidation.AspNetCore 7.6.103 -> Microsoft.AspNetCore.Mvc 2.1.0 -> Microsoft.AspNetCore.Mvc.TagHelpers 2.1.0 -> Microsoft.AspNetCore.Mvc.Razor 2.1.0 -> Microsoft.CodeAnalysis.Razor 2.1.0 -> Microsoft.CodeAnalysis.Common (>= 2.8.0) Project Name -> Microsoft.VisualStudio.Web.CodeGeneration.Design 2.0.0 -> Microsoft.VisualStudio.Web.CodeGenerators.Mvc 2.0.0 -> Microsoft.VisualStudio.Web.CodeGeneration 2.0.0 -> Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore 2.0.0 -> Microsoft.VisualStudio.Web.CodeGeneration.Core 2.0.0 -> Microsoft.VisualStudio.Web.CodeGeneration.Templating 2.0.0 -> Microsoft.VisualStudio.Web.CodeGeneration.Utils 2.0.0 -> Microsoft.CodeAnalysis.CSharp.Workspaces 2.3.1 -> Microsoft.CodeAnalysis.Workspaces.Common 2.3.1 -> Microsoft.CodeAnalysis.Common (= 2.3.1).

How can I solve this error?

I had the same problem and was upgrading to 2.1, but for some reason I needed to manually upgrade my Microsoft.CodeAnalysis.Common package from 2.8.0 to 2.8.2

Install-Package Microsoft.CodeAnalysis.Common -Version 2.8.2
                yes thank you. After running this command, I was able to upgrade to Microsoft.AspNetCore.App, replacing Microsoft.AspNetCore.All
– Colbs
                Aug 20, 2018 at 16:02

Just faced the same issue. Unfortunately, this package refers to .net core 2.1, which is incompatible with 2.0.

Here's how I managed to resolve this issue: - Install the 2.1 SDK from https://www.microsoft.com/net/download/windows - Follow migration instructions from https://learn.microsoft.com/en-us/aspnet/core/migration/20_21?view=aspnetcore-2.1

Hope it helps!

If you're project is running under .NET Core 3.1 LTS Then please install the following package into your targeted project.

Install-Package Microsoft.CodeAnalysis.Common -Version 3.6.0

And then

Install-Package Microsoft.CodeAnalysis.CSharp.Workspaces -Version 3.6.0

This will resolve your problem.

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.