Bug 55861 - MSBuild adds extra binding redirects added to .config files that xbuild does not
Summary: MSBuild adds extra binding redirects added to .config files that xbuild does not
Alias: None
Product: Tools
Classification: Mono
Component: msbuild ()
Version: 5.0 (2017-02)
Hardware: PC Mac OS
: --- normal
Target Milestone: 15.2
Assignee: Ankit Jain
Depends on:
Reported: 2017-05-01 15:42 UTC by Kyle White
Modified: 2017-05-02 18:53 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Kyle White 2017-05-01 15:42:05 UTC
When a project has an app.config file present with binding redirects, it appears at build time msbuild appears to add more binding redirects not specified in app.config while xbuild does not do this

I have a repro with the following project:

To reproduce:
1) clone that project
2) build it with xbuild
3) save MyShop.dll.config
4) Repeat 1-3 but build with msbuild instead
5) Now compare MyShop.dll.config from the xbuild build to the msbuild build

Expected results:
The files are the same, and the redirects are only those found in the projects app.config

Actual result:
This msbuild artifact has three more binding redirects, none of which are in app.config

The three new redirects are:

MyShop.dll.config comparison (msbuild on left, xbuild on right):

Mono version:
Mono JIT compiler version (2017-02/1d0445b Fri Apr 28 18:03:25 EDT 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  x86
	Disabled:      none
	Misc:          softdebug
	LLVM:          yes(3.6.0svn-mono-master/8b1520c)
	GC:            sgen (concurrent by default)
Comment 1 Ankit Jain 2017-05-01 17:36:57 UTC
Is this causing any issues? This behavior is controlled by the `$(AutoGenerateBindingRedirects)` property, which is not supported by xbuild. And the `Microsoft.Bcl.Build` package used in some of the projects sets that property to `true` causing the extra binding redirects to be generated.

Can you attach the full diag log? I couldn't build it out of the box. Did you have to upgrade Xamarin.Forms nuget?
Comment 2 Kyle White 2017-05-01 18:38:08 UTC
It doesn't cause any issues that I can tell immediately. I'm not sure what impact it could have though. 

Yes, I had to upgrade the Xamarin.Forms nuget to latest in all projects. 
Here is the diag build log: https://gist.github.com/kdubau/9069d24e6755d99e0142bee634ba1a41
Comment 3 Ankit Jain 2017-05-02 18:53:05 UTC
This is new and expected behavior. A user can opt out if it has any bad impact. And we'll have to wait for an actual issue to see if anything needs fixing here.