MSBuild.exe 给出有关 Nuget 包冲突的错误,这是什么意思? [英] MSBuild.exe gives errors about Nuget package conflicts, what does it mean?

查看:32
本文介绍了MSBuild.exe 给出有关 Nuget 包冲突的错误,这是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 VS2017 中工作我有一个使用多个 Nuget 包的 C# 项目 .Net 4.6.在我的 VS 开发机器上,它构建得很好,我已经测试过它可以从完全干净的状态恢复 Nuget 包并正确构建.

Working in VS2017 I have a C# project .Net 4.6 using several Nuget packages. On my dev machine from within VS it builds just fine, I've tested it will restore Nuget packages from completely clean and build correctly.

在我们的构建机器上,它是使用 MSBuild.exe 构建的,现在一切都出错了.

On our build machine it is build using MSBuild.exe and now everything is going wrong.

Build>C:\Program Files (x86)\Microsoft VisualStudio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe".sln"/p:配置=发布"/p:Platform=任何 CPU"/p:version=4.2.0.3230/m "适用于 .NET 的 Microsoft (R) 构建引擎版本 15.7.179.6572框架版权 (C) Microsoft Corporation.保留所有权利.

Build>"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe" ".sln" /p:Configuration="Release" /p:Platform="Any CPU" /p:version=4.2.0.3230 /m " Microsoft (R) Build Engine version 15.7.179.6572 for .NET Framework Copyright (C) Microsoft Corporation. All rights reserved.

我可以看到/packages 子目录按预期填充了包,但随后出现如下错误:

I can see the /packages sub-dir is getting populated as expected with packages but then I get errors like:

'Reference:System.Numerics.Vectors,版本=4.1.4.0,文化=中性,PublicKeyToken=b03f5f7f11d50a3a,processorArchitecture=MSIL' 和'平台:System.Numerics.Vectors.dll'.无法确定获胜者因为'参考:System.Numerics.Vectors,版本= 4.1.4.0,文化=中性,PublicKeyToken=b03f5f7f11d50a3a,processorArchitecture=MSIL' 不存在.'Platform:System.Numerics.Vectors.dll' 和'参考:System.Numerics.Vectors,版本=4.1.4.0,文化=中性,PublicKeyToken=b03f5f7f11d50a3a,处理器架构=MSIL'.可以不能确定获胜者,因为参考:System.Numerics.Vectors,版本=4.1.4.0,文化=中性,PublicKeyToken=b03f5f7f11d50a3a,processorArchitecture=MSIL' 不存在.

Encountered conflict between 'Reference:System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL' and 'Platform:System.Numerics.Vectors.dll'. Could not determine winner because 'Reference:System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL' does not exist. Encountered conflict between 'Platform:System.Numerics.Vectors.dll' and 'Reference:System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL'. Could not determine winner because 'Reference:System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL' does not exist.

My project file looks like:
    <Reference Include="System.Numerics" />
    <Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
    </Reference>

C:\Program Files (x86)\Microsoft VisualStudio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2106,5):警告 MSB3245:无法解析此引用.找不到程序集log4net,版本=2.0.8.0,文化=中性,PublicKeyToken=669e0ddf0bb1aa2a,处理器架构=MSIL".检查到确保程序集存在于磁盘上.如果需要此参考根据您的代码,您可能会收到编译错误.[]对于搜索路径{HintPathFromItem}".考虑过packages\log4net.2.0.8\lib\net45-full\log4net.dll",但没有存在.

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [] For SearchPath "{HintPathFromItem}". Considered "packages\log4net.2.0.8\lib\net45-full\log4net.dll", but it didn't exist.

我的意思是,这里是:

<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
  <HintPath>packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
</Reference>

每个构建都是一个完全干净的构建(它在之间被擦除)所以我可以清楚地看到 Nuget 已经下载了 log4net.dll

Every build is a completely clean build (it's wiped between) so I can clearly see Nuget has downloaded log4net.dll

我收到了很多这些,但我看不到任何解释原因,或者从哪里开始寻找解决方案.一切看起来都是应该的

I am getting loads of these and I cannot see any explanation why, or where to start looking for a solution. Everything looks to be where it should be

推荐答案

您可以尝试将配置文件中的绑定重定向更改为 2.8.0 of log4net

You can try changing a binding redirect in your config file to 2.8.0 of log4net

<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.8.0" newVersion="2.0.8.0" />

这篇关于MSBuild.exe 给出有关 Nuget 包冲突的错误,这是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆