Bug 44193 - Warning when building Forms app: MSB3247 Found conflicts between different versions of the same dependent assembly
Summary: Warning when building Forms app: MSB3247 Found conflicts between different ve...
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild (show other bugs)
Version: 7.0 (C8)
Hardware: PC Windows
: Normal normal
Target Milestone: 7.0.1 (C8SR1)
Assignee: dean.ellis
URL:
: 44446 44699 45130 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-09-12 15:25 UTC by Manish Sinha
Modified: 2018-03-12 20:28 UTC (History)
19 users (show)

Tags: XATriaged BZRC8S1_C7SR1S1
Is this bug a regression?: Yes
Last known good build: Cycle 7 – Service Release 1

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 Developer Community or GitHub 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:
Status:
VERIFIED FIXED

Description Manish Sinha 2016-09-12 15:25:21 UTC
Steps to reproduce

1. Install XS 6.1.0.5441 on windows with XVS 4.2.0.670
2. Create Forms App
3. Build

Expected: The solution builds without any errors or warnings
Actual: There is a build warning

⁠⁠⁠⁠C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2113,3): warning MSB3247: Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file:   (MSB3247)

Build output: http://xqa.blob.core.windows.net/gist/log-82b13711ec19412d89780bdecf930f28.txt
XS Info: http://storage.bos.internalx.com/QA-xs_win_uitest_long-cycle8/68/68292d1ab289911c815ddc715dd7cc29a9752f9f/XQA-XS-Win10/TestCreateBuildFormsApp/TestCreateBuildFormsApp.Ide.log
Comment 2 Atsushi Eno 2016-09-13 04:47:55 UTC
@akoeplinger: do you have any idea if it might be related to the changes mentioned above?
Comment 3 Brendan Zagaeski (Xamarin Team, assistant) 2016-09-15 03:11:09 UTC
## Tallying a user report of this issue

http://forums.xamarin.com/discussion/77663/found-conflicts-between-different-version-of-the-same-dependent-assembly-wont-go-away/p1
Comment 4 Brendan Zagaeski (Xamarin Team, assistant) 2016-09-17 00:01:45 UTC
## Tallying 2 additional user reports (from the same forum thread)

2016/09/15 http://forums.xamarin.com/discussion/comment/221022/#Comment_221022
2016/09/15 http://forums.xamarin.com/discussion/comment/221036/#Comment_221036
Comment 6 Brendan Zagaeski (Xamarin Team, assistant) 2016-09-17 00:57:51 UTC
*** Bug 44446 has been marked as a duplicate of this bug. ***
Comment 7 Brendan Zagaeski (Xamarin Team, assistant) 2016-09-17 01:43:37 UTC
## Tallying 2 additional user reports from the forums

2016/09/16 http://forums.xamarin.com/discussion/77847/all-the-warnings-about-consider-app-config-remapping-of-assembly-after-adding-a-netstandard
2016/09/16 http://forums.xamarin.com/discussion/comment/221582/#Comment_221582
Comment 8 llama 2016-09-19 06:35:23 UTC
I am also experiencing this bug.
Comment 9 Alexander Köplinger [MSFT] 2016-09-19 12:59:53 UTC
@Atsushi: the commit that changed the version numbers was this one: https://github.com/mono/mono/commit/406a5b817797aeb440abb62c780d80cb88547607 (or f099ee2 in mono-4.6.0-branch).

I'll talk to Marek what we can do about the warning.
Comment 10 Morgan C. 2016-09-20 06:34:52 UTC
Having same issue when donwloading samples from xamarin.com and from when creating them from scratch.  
 
Sample from log..

2>  Consider app.config remapping of assembly "System.Xml.XDocument, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.0.0.0" [C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml.XDocument\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Xml.XDocument.dll] to Version "4.0.10.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Xml.XDocument.dll] to solve conflict and get rid of warning.
2>  Consider app.config remapping of assembly "Newtonsoft.Json, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" from Version "6.0.0.0" [] to Version "9.0.0.0" [C:\\Documents\GitHub\tildyit\packages\Newtonsoft.Json.9.0.1\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll] to solve conflict and get rid of warning.
2>  Consider app.config remapping of assembly "System.Threading.Tasks, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.0.0.0" [C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Threading.Tasks\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Threading.Tasks.dll] to Version "4.0.10.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Threading.Tasks.dll] to solve conflict and get rid of warning.
2>  Consider app.config remapping of assembly "System.Dynamic.Runtime, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.0.0.0" [C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Dynamic.Runtime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Dynamic.Runtime.dll] to Version "4.0.10.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Dynamic.Runtime.dll] to solve conflict and get rid of warning.
2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2113,3): warning MSB3247:
Comment 11 Mus2635 2016-10-13 14:09:04 UTC
I have the same problem, new installation of Visual studio 2015 community, when I create a new project, restore, clean everything like the others above and still get the error on a "clean project" the system created and it doesn't work... about to give up learning Xamarin because of crappy software!

hope I get updated with a mail or something so I can try again, until then I give up on Xamarin :o)
Comment 12 Brendan Zagaeski (Xamarin Team, assistant) 2016-10-13 15:58:58 UTC
Note that what's been seen in the various reports of this issue so far is that these messages are _warnings_ rather than errors.  If this particular bug is the only one you are hitting then in theory you should be able to proceed with development for now by ignoring these warnings, as long as you are OK with leaving the "Treat all warnings as errors" setting for the build process [1] switched OFF (which is the default).


[1] https://msdn.microsoft.com/en-us/library/edzzzth4(v=vs.100).aspx
Comment 13 Shane 2016-10-13 18:50:41 UTC
To Brendan's point, we've been up and running in production with these warnings for quite some time and haven't ran into any issues.  

I've probably also grown a bit immune to worrying about warnings like this from the BCL warnings.... You're installed everywhere I promise please stop warning me about it :-/

These warnings are more just a nuisance than anything else so don't give up :-)
Comment 14 tranb3r 2016-10-14 06:56:46 UTC
Considering the number of people affected by this bug, could you please provide us with an ETA for a fix ?
Comment 15 dean.ellis 2016-10-17 15:52:29 UTC
@Manish

are you able to post a diagnostic build log for this issue? The one you linked to in comment 1 does not contain the full diagnostic output.
Comment 17 dean.ellis 2016-10-19 11:09:04 UTC
Adding the following app.config values will remove the waring

https://gist.github.com/dellis1972/001271bd681fa533c3cdedb5280d65e7
Comment 18 dean.ellis 2016-10-19 11:42:15 UTC
The reason for the warning is due to PCL library references. 
In the test case I have the PCL references the Facade Assemblies in MonoAndroid/v1.0/Facades All of these assemblies have a version of 4.0.0.0

The actual application reference are resolved to 
MonoAndroid/v1.0  or Monondroid/vX.0 depending on the target framework version. 
All of the assemblies in these directories have been updated to meet the .Net Standard and as such have a version of 4.0.10.0 (they used to be 4.0.0.0).

This is what triggers the warning. NOTE it is a warning not an error. 
I don't think we can change the version numbers in the Facade assemblies since that would probably break PCL compatibility. So I think the best course of action is to add an app.config to the project which contains the following 

<?xml version="1.0" encoding="utf-8"?>
<configuration>
	<runtime>
		<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
			<dependentAssembly>
				<assemblyIdentity name="System.Runtime" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/>
				<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0"/>
			</dependentAssembly>
		</assemblyBinding>
	</runtime>
</configuration>

this will make sure that the Facade assembly versions are redirected correctly. 

I will look into adding this automatically as part of the build process if an app.config does not exist. But I am not sure if that will cause any other issues.
Comment 19 tranb3r 2016-10-19 12:15:12 UTC
Unfortunately, I believe app.config is ignored in an Android project.
So, can you please explain in more details how you've managed to get rid of the warnings?

A similar issue has already been discussed here: https://bugzilla.xamarin.com/show_bug.cgi?id=22670
Comment 20 dean.ellis 2016-10-19 12:54:35 UTC
PR up https://github.com/xamarin/xamarin-android/pull/273
Comment 21 dean.ellis 2016-10-19 13:20:48 UTC
I just added a new xml file called app.config and pasted the code from Comment 18 into it. Xamarin.Android itself probably doesn't use the app.config but the build process will and it will remove the warning.
Comment 22 dean.ellis 2016-10-26 09:11:54 UTC
Fixed in xamarin-android/master/78b0ff92
Comment 23 dean.ellis 2016-10-26 09:19:52 UTC
the x-a bump was included in the following commit


monodroid/master/5c074fda
Comment 25 Brendan Zagaeski (Xamarin Team, assistant) 2016-10-28 23:05:15 UTC
*** Bug 45130 has been marked as a duplicate of this bug. ***
Comment 26 Brendan Zagaeski (Xamarin Team, assistant) 2016-10-28 23:10:31 UTC
## Regression status: Regression in Cycle 8 compared to Cycle 7 – Service Release 1

BAD:  XamarinVS 4.2.1.15  (2ecdcdd) (with Xamarin.Android 7.0.2.28 (d3dc82d))
(Cycle 8 – Service Release 1, current Beta)

BAD:  XamarinVS 4.2.0.680 (c4382f5) (with Xamarin.Android 7.0.0.18 (0e59c36))
(Cycle 8)

GOOD: XamarinVS 4.1.2.18  (fcbe082) (with Xamarin.Android 6.1.2.21 (1cf254d))
(Cycle 7 – Service Release 1)


(I tested with a new template "Visual C# > Cross-Platform > Blank App (Xamarin.Forms Portable)" project as well as the test case from duplicate Bug 45130, Comment 1.  The results were the same for both cases.)




## Preliminary verification status (by manually applying the candidate fix): verified fixed by the candidate fix from Comment 20

GOOD: XamarinVS 4.2.1.15 (2ecdcdd) after manually adjusting the .targets file [1] as per the pull request from [2]

[1] %ProgramFiles(x86)%\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets 

[2] https://github.com/xamarin/xamarin-android/pull/273/files




## BAD results 

The build completes successfully, but produces a warning as described in the previous comments:

> warning MSB3247: Found conflicts between different versions of the same
> dependent assembly. In Visual Studio, double-click this warning (or select it
> and press Enter) to fix the conflicts; otherwise, add the following binding
> redirects to the "runtime" node in the application configuration file: 
> 
> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Runtime" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /></dependentAssembly></assemblyBinding>
> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Text.RegularExpressions" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /></dependentAssembly></assemblyBinding>
> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.IO" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /></dependentAssembly></assemblyBinding>

etc.




## GOOD results (with the .targets file fix or the Cycle 7 SR 1 versions)

The build completes with 0 warnings and 0 errors.




## Additional test environment info (brief)

Microsoft Visual Studio Enterprise 2015
Version 14.0.25425.01 Update 3
Microsoft .NET Framework
Version 4.6.01586

Windows 10, Version 1607 (OS Build 14393.187)
Comment 29 Manish Sinha 2016-11-01 17:12:20 UTC
Verified it with XVS 4.2.1.52 and I don't encounter an warnings.
Comment 30 dean.ellis 2016-11-11 10:57:59 UTC
*** Bug 44699 has been marked as a duplicate of this bug. ***
Comment 31 Alessandro 2018-03-12 12:03:33 UTC
Today I have the same problem

/Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(2057,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file: <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Runtime" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Threading.Tasks" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Net.Http.Primitives" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.2.29.0" newVersion="4.2.29.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.IO" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="XLabs.Serialization" culture="neutral" publicKeyToken="d65109b36e5040e4" /><bindingRedirect oldVersion="0.0.0.0-2.0.5782.15703" newVersion="2.0.5782.15703" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Net.Http" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding>
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2245,3): warning MSB3247: Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file: <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Runtime" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Threading.Tasks" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Net.Http.Primitives" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.2.29.0" newVersion="4.2.29.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.IO" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="XLabs.Serialization" culture="neutral" publicKeyToken="d65109b36e5040e4" /><bindingRedirect oldVersion="0.0.0.0-2.0.5782.15703" newVersion="2.0.5782.15703" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Net.Http" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding>
    2 Warning(s)
    0 Error(s)

=== Visual Studio Community 2017 for Mac ===

Version 7.4 (build 1033)
Installation UUID: e9c85728-289a-4de3-8442-d551ea358311
Runtime:
	Mono 5.8.0.129 (2017-10/835a98d8559) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 508000129

=== NuGet ===

Versione: 4.3.1.4445

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
Versioni runtime:
	2.0.5
	2.0.0
	1.1.1
	1.0.4
SDK: /usr/local/share/dotnet/sdk/2.1.4/Sdks
Versioni SDK:
	2.1.4
	2.0.0
	1.0.3
SDK di MSBuild: /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

Versione: 1.6.1
Percorso: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Xamarin.Android ===

Versione: 8.2.0.15 (Visual Studio Community)
Android SDK: /Users/alessandrocaliaro/Library/Developer/Xamarin/android-sdk-macosx
	Versione di Android supportate:
		6.0 (livello API 23)
		7.1 (livello API 25)
		8.0 (livello API 26)

Versione degli strumenti SDK: 25.2.5
Versione degli strumenti della piattaforma SDK: 27.0.1
Versione degli strumenti di compilazione SDK: 25.0.3

Java SDK: /usr
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

Il codice EPL di Android Designer è disponibile qui:
https://github.com/xamarin/AndroidDesigner.EPL

=== Apple Developer Tools ===

A valid Xcode installation was not found at the configured location: '/Applications/Xcode.app'

=== Xamarin.Mac ===

Version: 4.2.0.20 (Visual Studio Community)

=== Xamarin.iOS ===

Version: 11.8.0.20 (Visual Studio Community)
Hash: 1c6f300e
Branch: d15-6
Build date: 2018-02-07 23:42:40-0500

=== Xamarin Inspector ===

Version: 1.4.0
Hash: b3f92f9
Branch: master
Build date: Fri, 19 Jan 2018 22:00:34 GMT
Client compatibility: 1

=== Build Information ===

Release ID: 704001033
Git revision: 053991068f3c88497d3e5cc52fe7fdf57c28b62f
Build date: 2018-02-28 05:02:28-05
Xamarin addins: cc3283953e0af0b8bfab1bdfdf847d9e403c4606
Build lane: monodevelop-lion-d15-6

=== Operating System ===

Mac OS X 10.13.3
Darwin 17.4.0 Darwin Kernel Version 17.4.0
    Sun Dec 17 09:19:54 PST 2017
    root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64

=== Enabled user installed addins ===

Internet of Things (IoT) development (Preview) 7.1
Comment 32 Brendan Zagaeski (Xamarin Team, assistant) 2018-03-12 20:28:23 UTC
Hi Alessandro,

This report is quite old and has been closed for a long time, so you'll want to file a new report (at https://github.com/xamarin/xamarin-android/issues/) for the issue you're seeing, ideally attaching a small test case project that reproduces the problem.  Thanks in advance!