当我构建项目时,我收到一个恼人的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 :(得分:2)
此问题的原因是StrongGrid
包的编写不正确。
0.30
的版本StrongGrid
是针对3.1.0
的版本Pathoschild.Http.FluentClient
构建的,但用于创建NuGet包的.nuspec
文件仍列出版本{ {1}}作为依赖项,因此使用项目将获取旧版本,从而产生无法解决的冲突。
要解决此问题,您可以通过向csproj文件添加程序包引用来显式引用3.0.0
的{{1}}版本以覆盖该版本。