2017-10-04 1074 views
2

我在构建项目时遇到恼人的MSB3277警告。我增加了冗长到“详细”,我能得到从日志中的以下信息:如何诊断警告MSB3277:在无法解析的相同相关程序集的不同版本之间发现冲突

 There was a conflict between "Pathoschild.Http.Client, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null" and "Pathoschild.Http.Client, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null". 
     "Pathoschild.Http.Client, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null" was chosen because it was primary and "Pathoschild.Http.Client, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null" was not. 

     References which depend on "Pathoschild.Http.Client, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null" [C:\Users\desau\.nuget\packages\pathoschild.http.fluentclient\3.0.0\lib\netstandard1.3\Pathoschild.Http.Client.dll]. 
      C:\Users\desau\.nuget\packages\pathoschild.http.fluentclient\3.0.0\lib\netstandard1.3\Pathoschild.Http.Client.dll 
       Project file item includes which caused reference "C:\Users\desau\.nuget\packages\pathoschild.http.fluentclient\3.0.0\lib\netstandard1.3\Pathoschild.Http.Client.dll". 
       C:\Users\desau\.nuget\packages\pathoschild.http.fluentclient\3.0.0\lib\netstandard1.3\Pathoschild.Http.Client.dll 

     References which depend on "Pathoschild.Http.Client, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null" []. 
      C:\Users\desau\.nuget\packages\stronggrid\0.30.0\lib\netstandard1.3\StrongGrid.dll 
       Project file item includes which caused reference "C:\Users\desau\.nuget\packages\stronggrid\0.30.0\lib\netstandard1.3\StrongGrid.dll". 
       C:\Users\desau\.nuget\packages\stronggrid\0.30.0\lib\netstandard1.3\StrongGrid.dll 

如果我理解正确的这篇日志,它告诉我,我的项目引用Pathoschild.Http.Client 3.0版,也版本3.1。我理解3.1版的参考,因为我的项目引用了一个名为StrongGrid的nuget包,它本身引用Pathoschild版本3.1

但我无法理解对3.0版本的引用来自哪里。

我使用的是Visual Studio 2017和MSBuild 15,以防有用的信息。

+0

您是否使用VS 2017版本15.3和.NET Core SDK 2.0.0? (在8月份发布) - 它们应该包含必要的冲突解决逻辑 –

+0

VS 2017版本15.3.5,并且在从命令提示符构建时,它仅仅表示“使用工具版本构建”15.0“' – desautelsj

+0

运行'dotnet --info': .NET命令行工具(2.0.0)' – desautelsj

回答

2

此问题的原因是StrongGrid程序包的创作不正确。

版本的StrongGrid0.30是建立针对Pathoschild.Http.FluentClient3.1.0版本,但用于创建NuGet包的.nuspec文件还列出了版本3.0.0的依赖,所以消费项目将获取的旧版本,创建不能有冲突解决。

要解决此问题,您可以通过向csproj文件添加软件包引用以覆盖版本,明确引用的3.1.0版本。

相关问题