简体   繁体   English

错误NU1107版本冲突检测到Microsoft.CodeAnalysis.Common

[英]Error NU1107 Version conflict detected for Microsoft.CodeAnalysis.Common

After upgrading a test project from .NET Core 2.0 to 2.1 I started getting the following error on build: 将测试项目从.NET Core 2.0升级到2.1之后,我开始在构建过程中遇到以下错误:

Error       Package restore failed. Rolling back package changes for 'Api.Tests'.

Error   NU1107  Version conflict detected for Microsoft.CodeAnalysis.Common. Install/reference Microsoft.CodeAnalysis.Common 2.8.2 directly to project Api.Tests to resolve this issue. 
    Api.Tests -> Api -> Microsoft.CodeAnalysis.Common (>= 2.8.2) 
    Api.Tests -> Microsoft.AspNetCore.Mvc 2.0.3 -> Microsoft.AspNetCore.Mvc.Localization 2.0.3 -> Microsoft.AspNetCore.Mvc.Razor 2.0.3 -> Microsoft.CodeAnalysis.CSharp 2.3.1 -> Microsoft.CodeAnalysis.Common (= 2.3.1).   Api.Tests

Error   NU1107  Version conflict detected for Microsoft.CodeAnalysis.Common. Install/reference Microsoft.CodeAnalysis.Common 2.8.2 directly to project Api.Tests to resolve this issue. 
    Api.Tests -> Api -> Microsoft.CodeAnalysis.Common (>= 2.8.2) 
    Api.Tests -> Microsoft.AspNetCore.Mvc 2.2.0-preview3-35497 -> Microsoft.AspNetCore.Mvc.Localization 2.2.0-preview3-35497 -> Microsoft.AspNetCore.Mvc.Razor 2.2.0-preview3-35497 -> Microsoft.CodeAnalysis.CSharp 2.8.0 -> Microsoft.CodeAnalysis.Common (= 2.8.0).  Api.Tests

I tried installing Microsoft.CodeAnalysis.Common 2.8.2 directly in the project but it gave the following error: 我尝试直接在项目中安装Microsoft.CodeAnalysis.Common 2.8.2,但出现以下错误:

Restoring packages for Api.Tests.csproj...
NU1608: Detected package version outside of dependency constraint: Microsoft.CodeAnalysis.CSharp 2.3.1 requires Microsoft.CodeAnalysis.Common (= 2.3.1) but version Microsoft.CodeAnalysis.Common 2.8.2 was resolved.
NU1608: Detected package version outside of dependency constraint: Microsoft.CodeAnalysis.Workspaces.Common 2.3.1 requires Microsoft.CodeAnalysis.Common (= 2.3.1) but version Microsoft.CodeAnalysis.Common 2.8.2 was resolved.
Install-Package : NU1605: Detected package downgrade: Microsoft.AspNetCore.Mvc from 2.2.0-preview3-35497 to 2.0.3. Reference the package directly from the project to select a different version. 
Api.Tests -> Services -> CommStack.Conference.Web.Api.Client 1.0.0-CI-20181128-112729 -> CommStack.Web.Api.Client.Common 1.0.0-CI-20181128-112729 -> Microsoft.AspNetCore.Mvc (>= 2.2.0-preview3-35497) 
Api.Tests -> Microsoft.AspNetCore.Mvc (>= 2.0.3)
At line:1 char:1
+ Install-Package Microsoft.CodeAnalysis.Common -Version 2.8.2
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : Package restore failed. Rolling back package changes for 'Api.Tests'.
At line:1 char:1
+ Install-Package Microsoft.CodeAnalysis.Common -Version 2.8.2
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Any suggestions on how to fix this? 对于如何解决这个问题,有任何的建议吗?

To solve this issue you have to explicitly install either 要解决此问题,您必须显式安装

<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.*" />

or 要么

<PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.*" />

to your test project depending on a package you use in your API project. 测试项目,具体取决于您在API项目中使用的软件包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在单元测试项目中检测到NU1107版本冲突 - NU1107 Version conflict detected in Unit Test project 将Microsoft.CodeAnalysis.Common安装到Visual Studio 2015 - Installing Microsoft.CodeAnalysis.Common to Visual Studio 2015 NU1107:Microsoft.EntityFrameworkCore.SqlServer 的 .Net Core 2.1 兼容替代品? - NU1107: .Net Core 2.1-compatible alternatives to Microsoft.EntityFrameworkCore.SqlServer? NU1107-更新nuget包时的Xamarin Android错误 - NU1107 - Xamarin Android erro when updating nuget packages 检测到 Microsoft.EntityFrameworkCore.Install 的版本冲突 - Version Conflict detected for Microsoft.EntityFrameworkCore.Install 检测到 NuGet 包的版本冲突 - Version conflict detected for NuGet packages 在 .NetCore 2.2 中检测到 Microsoft.EntityFrameworkCore.Install Reference 3.1.2 的版本冲突问题? - Issue with Version Conflict detected for Microsoft.EntityFrameworkCore.Install Referance 3.1.2 in .NetCore 2.2? Microsoft.CodeAnalysis:使用Newtonsoft JObject编译动态代码时出错 - Microsoft.CodeAnalysis: Error compiling dynamic code with Newtonsoft JObject 错误 NU1202: Package Microsoft.AspNetCore.Blazor.Cli 0.7.0 与 netcoreapp2.0 (.NETCoreApp,Version=v2.0) 不兼容 - error NU1202: Package Microsoft.AspNetCore.Blazor.Cli 0.7.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0) 如何使用 Microsoft.CodeAnalysis.Diagnostic 获取错误行 - How to get error line using Microsoft.CodeAnalysis.Diagnostic
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM