Microsoft.Bcl.Build 有什么用

Microsoft.Bcl.Build What is it used for

我刚刚尝试从 GitHub 下载并构建 DotNetOpenAuth.Samples。但是从 nuget.targets 得到一个错误说 The process cannot access the file 'xxx\tools\Microsoft.Bcl.Build.Tasks.dll' because it is being used by another process

所以我签入了目标文件。发现 <RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" -o "$(PackagesDir)"</RestoreCommand> 导致错误。

packages.config中我找到了<package id="Microsoft.Bcl.Build" version="1.0.8" targetFramework="net40" />的定义。

因为我发现项目并没有真正引用dll。所以我只是评论包配置。并重建它。错误消失了。

但我的问题是为什么这个包在包配置中定义时没有在项目中引用? (Microsoft.Bcl.Build) 有什么用?

谢谢。

已更新

忘记添加来自 nuget 的信息。

This package provides build infrastructure components so that projects referencing specific Microsoft packages can successfully build.

Do not directly reference this packages unless you receive a build warning that instructs you to add a reference.

还是没看懂..

简而言之,它是 NuGet 包的辅助层。 Microsoft.Bcl.Build 1.0 的 announcement 提供了详细信息:

The new version of Microsoft.Bcl.Build will ensure that solutions containing our packages will load successfully even if packages aren’t restored yet. This affects all .NET NuGet packages that depend on it, such as Microsoft.Net.Http, Microsoft.Bcl, and Microsoft.Bcl.Async.

Microsoft.Bcl.Build will give an actionable error message in cases the package was missing by asking you to build again.

When coupled with NuGet 2.7 where package restore is automatic in Visual Studio and isn’t implemented through MSBuild, the experience is transparent and smooth. However, this doesn’t address build server scenarios yet so you still need run nuget.exe restore solution.sln prior to build, or check-in the .targets file if preferred.