如何绕过Microsoft.Bcl.Build警告 [英] How to bypass Microsoft.Bcl.Build warning

查看:552
本文介绍了如何绕过Microsoft.Bcl.Build警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含多个项目的解决方案,其中一个项目显示此构建警告,显示

I have a solution with multiple projects, one of them has this build warning that shows

所有引用Project.csproj的项目都必须安装nuget 包Microsoft.Bcl.Build

All projects referencing Project.csproj must install nuget package Microsoft.Bcl.Build

我想摆脱这种警告,因为我们将采用一种干净的构建方法进行构建集成,其中所有警告都将被视为错误.因此,在推送到会触发CI构建的远程存储库之前,应清除所有警告和错误,并且要成功合并到主构建中.

I want to get rid of this warning as we are going to apply a clean build approach for build integration where all warnings would be counted as error. So all warnings and errors should be cleared before pushing to remote repository which would trigger the CI build, and for merging in master build needs to be successful.

如何删除/禁止/绕过此警告?

How can I Remove/Suppress/Bypass this particular warning?

推荐答案

我已通过完全删除所有 Microsoft.Bcl 解决了该问题 和 Microsoft.Bcl.Build 参考,如@nozzleman在注释中建议的.

I have resolved the issue by completely removing all Microsoft.Bcl and Microsoft.Bcl.Build references as @nozzleman suggested in comments.

尽管解决方案资源管理器的References列表中没有dll引用,但package.config中有以下两个软件包的条目:

Although no dll references were present in the References list in solution explorer, there were entries in package.config for those 2 packages as below:

<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net461" />
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net461" />

我对 Microsoft.Bcl Microsoft.Bcl.Build 进行了完整的搜索(Ctrl + F),并从package.config中删除了所有这些条目.以及来自.csproj文件的条目,如下所示:

I did a search (Ctrl + F) in full solution for the terms Microsoft.Bcl and Microsoft.Bcl.Build and removed all those entries from packages.config and also from .csproj files which had entries like below:

<Import Project="..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
  <Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
    <Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
    <Error Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
  </Target>

这些行是在安装之前附加的,并且有人通过按 Delete 键手动删除了引用,但它们并未被删除.

Those lines were appended when it was installed before and as someone manually removed references by pressing Delete key, they were not removed.

从所有地方清理完这2个项目后,警告便从构建中消失了.

After cleaning those 2 items from everywhere the warning is gone from build.

这篇关于如何绕过Microsoft.Bcl.Build警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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