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: 2017-06-25 11:12 UTC (History)
18 users (show)

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


Attachments

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 Support) 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 Support) 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 Support) 2016-09-17 00:57:51 UTC
*** Bug 44446 has been marked as a duplicate of this bug. ***
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 Support) 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 Support) 2016-10-28 23:05:15 UTC
*** Bug 45130 has been marked as a duplicate of this bug. ***
Comment 26 Brendan Zagaeski (Xamarin Support) 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. ***

Note You need to log in before you can comment on or make changes to this bug.