简体   繁体   中英

NU1107: Version conflict detected for Microsoft.CodeAnalysis.Common

I'm having issues when I try to build the application that leads me to run a package restore, but that fails, and I can't update packages either.

NU1107  Version conflict detected for Microsoft.CodeAnalysis.CSharp.Workspaces.
Install/reference Microsoft.CodeAnalysis.CSharp.Workspaces 4.4.0 directly to project DACRL.Portal.Admin to resolve this issue. 

 DACRL.Portal.Admin -> Microsoft.VisualStudio.Web.CodeGeneration.Design 7.0.1 -> Microsoft.VisualStudio.Web.CodeGenerators.Mvc 7.0.1 -> Microsoft.VisualStudio.Web.CodeGeneration 7.0.1 -> Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore 7.0.1 -> Microsoft.VisualStudio.Web.CodeGeneration.Core 7.0.1 -> Microsoft.VisualStudio.Web.CodeGeneration.Templating 7.0.1 -> Microsoft.VisualStudio.Web.CodeGeneration.Utils 7.0.1 -> Microsoft.CodeAnalysis.CSharp.Workspaces (>= 4.4.0) 
 DACRL.Portal.Admin -> Telerik.UI.for.AspNet.Core 2022.3.1109 -> Microsoft.CodeAnalysis 4.0.0 -> Microsoft.CodeAnalysis.CSharp.Workspaces (= 4.0.0).

I have the latest SDK installed:

dotnet --list-sdks

And the whole solution (each project) is set to .net 7.0:

<TargetFramework>net7.0</TargetFramework>

And the global.json is also setup correctly:

{
  "sdk": {
    "version": "7.0.101"
  }
}

The last thing that it advises is to manually install Microsoft.CodeAnalysis.Common 4.4.0 directly to project DACRL.Portal.Admin , and that also fails.

NU1107: Version conflict detected for Microsoft.CodeAnalysis.Common.
Install/reference Microsoft.CodeAnalysis.Common 4.4.0 directly to project DACRL.Portal.Admin to resolve this issue. 

 DACRL.Portal.Admin -> Microsoft.CodeAnalysis.CSharp.Workspaces 4.4.0 -> Microsoft.CodeAnalysis.Common (= 4.4.0) 
 DACRL.Portal.Admin -> Microsoft.VisualStudio.Web.CodeGeneration.Design 7.0.0 -> Microsoft.DotNet.Scaffolding.Shared 7.0.0 -> Microsoft.CodeAnalysis.CSharp.Features 4.0.0 -> Microsoft.CodeAnalysis.Common (= 4.0.0).

It seems that Telerik.UI.for.AspNet.Core 2022.3.1109 added v4.0.0 of Microsoft.CodeAnalysis.* DLLs. I had to manually add the following NuGtes:

  • Microsoft.CodeAnalysis.Common

  • Microsoft.CodeAnalysis.Workspaces.Common

  • Microsoft.CodeAnalysis.CSharp

  • Microsoft.CodeAnalysis.CSharp.Workspaces

  • Microsoft.CodeAnalysis.VisualBasic

  • Microsoft.CodeAnalysis.VisualBasic.Workspaces

Now, solution compiles and NuGets get appropriately updated.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM