Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm unable to find any documentation on this - the links from the Microsoft.Bcl.Build Nuget page don't provide much help:

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.

From looking at the Microsoft.Bcl.Build.targets file, it looks like it manages binding redirects and package references. It looks like some of this functionality is used only when running in Visual Studio.

Can anyone provide any more information on what this package does? It's a pain in our build server environment, can it be ignored when building entirely from source code (eg build server environment)?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
745 views
Welcome To Ask or Share your Answers For Others

1 Answer

From looking at Microsoft.Bcl.Build.targets, it has a bunch of project configuration targets, eg:

  • EnsureBindingRedirects - Determine which references are opted in for binding redirects, and update the app.config with them
  • BclBuildValidateNugetPackageReferences - This target validates that any Nuget packages installed in the current project also have their dependencies (transitive dependencies) installed in the current project.

So based on this evaluation, I decided that this functionality is only needed in a dev environment, when adding/removing/updating NuGet dependencies; and that it could be ignored in a CI environment, where it's causing problems.

So I want to keep the dependency in my *.csproj files, but ignore it when running a CI build. I did that by adding a conditional import on a build environment targets file (eg builder.targets), which includes this block:

<!-- Skip Microsoft.Bcl.Build functionality when building only from Source. -->
<PropertyGroup>
  <BclBuildImported>Ignore</BclBuildImported>
</PropertyGroup>

This has the net effect of ignoring the targets in a CI environment, but activating them in a development environment. I've had this running for over a week, and no problems so far...

I'd still love to know if anyone has better information on this package that indicates that doing this is a bad idea. So far I'm of the opinion that it's a good idea.

Edit 2018-02-01:

Note that the ignore parameter can also be passed on the command-line, to skip the Microsoft.Bcl.Build.targets logic:

msbuild (targets, etc) /p:BclBuildImported=Ignore

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...