Bug 22670 - Build warnings after referencing Microsoft.Net.Http NuGet package in Xamarin.Android app project
Summary: Build warnings after referencing Microsoft.Net.Http NuGet package in Xamarin....
Status: VERIFIED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android ()
Version: unspecified
Hardware: PC Windows
: Normal normal
Target Milestone: 15.4
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-09-04 21:31 UTC by dsplaisted
Modified: 2017-07-27 12:02 UTC (History)
28 users (show)

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


Attachments
project with no warning (28.68 KB, application/zip)
2015-05-08 12:00 UTC, Peter Collins
Details
project with warning (15.90 KB, application/zip)
2015-05-08 12:00 UTC, Peter Collins
Details


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 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 dsplaisted 2014-09-04 21:31:30 UTC
- In Visual Studio, create a new Xamarin.Android app
- Add a reference to the Microsoft.Net.Http NuGet package (currently version 2.2.28)
- Build project

EXPECTED: No errors or warnings
ACTUAL: Warnings about version conflicts for System.Net.Http DLL in build output:

1>  Consider app.config remapping of assembly "System.Net.Http, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "1.5.0.0" [] to Version "4.0.0.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Net.Http.dll] to solve conflict and get rid of warning.
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(602,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.Net.Http" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding>
1>  Consider app.config remapping of assembly "System.Net.Http, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "1.5.0.0" [] to Version "4.0.0.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Net.Http.dll] to solve conflict and get rid of warning.
1>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1696,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.Net.Http" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding>

NOTE: Warnings are not visible in the Visual Studio error list, you have to look at the actual build output text
Comment 1 Udham Singh 2014-09-08 08:45:18 UTC
I have checked this issue and getting the same behavior mentioned in bug description. To reproduce this issue I have followed the steps mentioned in bug description.

Screencast : http://www.screencast.com/t/y11S5dlJjT7G

output Log : https://gist.github.com/saurabh360/4ca7196566fbbb68d39c

Environment Info : 
Microsoft Visual Studio Professional 2013
Version 12.0.30501.00 Update 2
Microsoft .NET Framework
Version 4.5.51641

Xamarin   3.5.55.0 (2db5ccd228887372e207e112bc3b5f1b16b24293)
Comment 2 Jonathan Pryor 2014-12-18 17:23:43 UTC
I believe that you should file this issue is with the Microsoft.Http.Net NuGet package, and not with Xamarin.Android. Though the glory that is the Bait and Switch PCL trick, the Microsoft.Http.Net package contains monodroid specific assemblies:

> $ find packages/Microsoft.Net.Http.2.2.28/ -type f  | grep -i monoandroid
> packages/Microsoft.Net.Http.2.2.28//lib/monoandroid/System.Net.Http.Extensions.dll
> packages/Microsoft.Net.Http.2.2.28//lib/monoandroid/System.Net.Http.Primitives.dll
> packages/Microsoft.Net.Http.2.2.28//lib/monoandroid/System.Net.Http.Primitives.xml

This in turn implies that they have a Xamarin.Android-specific build, otherwise why would they have binaries for the "MonoAndroid" (==Xamarin.Android) platform?

However, their System.Net.Http.Extensions.dll assembly wants System.Net.Http.dll v1.5.0.0:

> $ monodis --assemblyref packages//Microsoft.Net.Http.2.2.28/lib/monoandroid/System.Net.Http.Extensions.dll
> AssemblyRef Table
> 1: Version=2.0.5.0
> 	Name=mscorlib
> 	Flags=0x00000100
> 	Public Key:
> 0x00000000: 7C EC 85 D7 BE A7 79 8E 
> 2: Version=1.5.0.0
> 	Name=System.Net.Http
> 	Flags=0x00000000
> 	Public Key:
> 0x00000000: B0 3F 5F 7F 11 D5 0A 3A 
> 3: Version=2.0.5.0
> 	Name=System.Core
> 	Flags=0x00000100
> 	Public Key:
> 0x00000000: 7C EC 85 D7 BE A7 79 8E 

Meanwhile, the System.Net.Http.dll assembly included with Xamarin.Android is v4.0.0.0, and long has been. (Always has been? I'm not sure.)

If Microsoft is going to provide MonoAndroid-specific binaries -- and they are! -- then they should ensure that the binaries they're providing were properly built against our assemblies, and thus should have the correct assembly versions.

[0]: http://log.paulbetts.org/the-bait-and-switch-pcl-trick/
Comment 3 dsplaisted 2014-12-18 18:33:51 UTC
I'm part of the team that owns the Microsoft.Http.Net NuGet package.

The System.Net.Http.Extensions.dll in the monoandroid folder is implemented as a portable library (and is the exact same DLL used for the .NET Framework).  

I'd expect that if an assembly has a reference to v1.5 of System.Net.Http then it would be satisfied by a higher version (ie 4.0).  Unfortunately in the .NET Framework this doesn't happen automatically and you need binding redirects (for strong named assemblies).  However, in newer .NET platforms where we aren't constrained by backwards compatibility with the existing binding logic, you don't need binding redirects and a higher assembly version will satisfy an assembly reference requirement for a lower version.

My understanding is that Mono does not need binding redirects and that everything works fine at runtime.  The bug is that when you build you get a warning saying that you do need the binding redirects.  I think that in the MSBuild target files for Xamarin.Android, they are probably setting (or not setting) a property that is causing the ResolveAssemblyReference MSBuild task to think that binding redirects are required if the version numbers don't match exactly.
Comment 4 dsplaisted 2014-12-18 18:40:25 UTC
To answer this question:

> This in turn implies that they have a Xamarin.Android-specific build, otherwise why would they have binaries for the "MonoAndroid" (==Xamarin.Android) platform?

This assembly has just a few APIs which are used to determine if various features are supported (AllowAutoRedirect, PreAuthenticate, ProtocolVersion, Chunked TransferEncoding, and UseProxy.  So we put this version of the assembly in the mono folders so that when running on mono, those features will be reported as available.  The version of this DLL in the "portable" lib folders doesn't report that the features are available, because on some of the platforms supported they aren't.
Comment 5 Jonathan Pryor 2014-12-19 12:47:12 UTC
> I think that in the MSBuild target files for Xamarin.Android, they are probably setting (or not
> setting) a property that is causing the ResolveAssemblyReference MSBuild task
> to think that binding redirects are required if the version numbers don't match exactly.

Presumably you mean the ResolveAssemblyReference.AutoUnify property:

http://msdn.microsoft.com/en-us/library/9ad3f294.aspx

Unfortunately, as per the output log in Comment #1 the warning is being produced from the ResolveAssemblyReferences target in Microsoft.Common.CurrentVersion.targets:

> Target "ResolveAssemblyReferences: (TargetId:21)" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "E:\Testing\test_31_Sep_2014\TestApp22670\TestApp22670\TestApp22670.csproj" (target "ResolveReferences" depends on it):
> Using "ResolveAssemblyReference" task from assembly "Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
> ...
>   There was a conflict between "System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Net.Http, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". (TaskId:13)
>   Consider app.config remapping of assembly "System.Net.Http, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "1.5.0.0" [] to Version "4.0.0.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Net.Http.dll] to solve conflict and get rid of warning. (TaskId:13)
> C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1696,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.Net.Http" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding>
> Done executing task "ResolveAssemblyReference". (TaskId:13)
> Done building target "ResolveAssemblyReferences" in project "TestApp22670.csproj".: (TargetId:21)

Clearly I have no control over C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets, so I can't fix that.

Oddly, I don't have that file on my Windows box either. :-(

However, assuming the above file is similar in purpose and content to %windir%\\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets (is it?), Xamarin.Android can set the ResolveAssemblyReferences.AutoUnify property by setting the  $(AutoUnifyAssemblyReferences) MSBuild property.

Does your "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" file use $(AutoUnifyAssemblyReferences)?
Comment 6 dsplaisted 2014-12-19 16:16:21 UTC
I talked with my team and investigated this more.  Yes, setting $(AutoUnifyAssemblyReferences) to true will turn off this behavior.  You probably also want to set $(AutoGenerateBindingRedirects) to false.  You will need to do this after you import Microsoft.CSharp.Targets in order to override the defaults that are set by the MSBuild targets.

As far as not having the targets file in the same path as I do: Since Visual Studio 2013, newer versions of MSBuild are no longer part of the .NET Framework.  They are part of Visual Studio (though there is a standalone installer that just installs the build tools).  So I suspect you don't have Visual Studio 2013 or later installed.  See this blog post for more info: http://blogs.msdn.com/b/visualstudio/archive/2013/07/24/msbuild-is-now-part-of-visual-studio.aspx
Comment 7 Jonathan Pryor 2014-12-19 16:46:12 UTC
Fixed in monodroid/61a9147d by setting the $(AutoUnifyAssemblyReferences) MSBuild property to True, and $(AutoGenerateBindingRedirects) to False.
Comment 8 Parmendra Kumar 2015-04-17 11:18:00 UTC
I have checked this issue and I am getting same behavior mentioned in the bug description.
Microsoft.Net.Http NuGet package (currently version 2.2.29)

Screencast: http://www.screencast.com/t/rd7uPybJ7

Build Output: https://gist.github.com/Parmendrak/c5f000be8417b8e8ecf6
ZipXam Log: https://gist.github.com/Parmendrak/b1b47889483eb7b56fcc

Hence reopening this issue.

Environment info:

Microsoft Visual Studio Professional 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.5.51641

Installed Version: Professional

Xamarin   3.11.439.0 (b9ed2c0)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   5.1.0.115 (d23da369e436488f38c8ab8fe8a9ae7d9ea5256b)
Visual Studio plugin to enable development for Xamarin.Android.
Comment 9 Jonathan Pryor 2015-05-06 17:24:10 UTC
This works as expected on OS X.

Does it generate the MSB3247 warning if you use MSBuild.exe from the command-line to build?
Comment 10 Abhishek 2015-05-07 07:19:58 UTC
I have checked this issue with the help of command line.

1.First time when I create the android application and build the application through command line then warning does not appear.

Build Output:https://gist.github.com/Abhishekk360/395c59a879d558ba8134

2.Once I build the application through Visual studio and then build the same application through command line then warning(MSB3247) get appear.

Build Output:https://gist.github.com/Abhishekk360/6942a473791831174bf4

Here is the screencast for the same: http://www.screencast.com/t/gAJrjBxTm
IDE log: https://gist.github.com/Abhishekk360/f5c17ed58880d48dfe7a

Environment Info:

Microsoft Visual Studio Professional 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.6.00007

Xamarin   3.11.507.0 (dfac85e)
Xamarin.Android   5.1.0.127 (cbdf025e886eacb95ce7adf53346961156fae990)
Xamarin.Forms Intellisense   1.0
Xamarin.iOS   8.10.0.0 (7741cc495ab0baf04ff0405d0604bc27f0ecae2e)
Xamarin.iOS Unified Migration   1.0
Xamarin.TestCloud.Integration   1.0
Comment 11 Abhishek 2015-05-07 07:22:24 UTC
Based on Comment 10, Reopening this issue.
Comment 12 Abhishek 2015-05-07 11:18:25 UTC
An update to issue, I have checked this issue with C5SR1 Xamarin.VisualStudio_3.11.538_36db3f63c496b3a032c093cac1b735e758baced9.
and I am stilling getting the same issue.

Screencast: http://www.screencast.com/t/sg2qDg3Fhh2B
Command Line Output: https://gist.github.com/Abhishekk360/99d92c7593e51459cde8
Build Output: https://gist.github.com/Abhishekk360/4dc04925cdf9f85df719
IDE Log: https://gist.github.com/Abhishekk360/17fd2b204c3df92848dc


Environment Info:

Microsoft Visual Studio Professional 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.6.00007

Xamarin   3.11.538.0 (36db3f6)
Xamarin.Android   5.1.1.0 (2fff837db393f75c4a7a32f5963918dd6168b015)
Xamarin.Forms Intellisense   1.0
Xamarin.iOS   8.10.1.0 (d8da1911bd2f0f1327a80560a7f286e6e221b0af)
Xamarin.iOS Unified Migration   1.0
Xamarin.TestCloud.Integration   1.0
Comment 13 Peter Collins 2015-05-07 17:30:51 UTC
I can only reproduce this when adding this NuGet to a project from VS. If I create the project from XS the warning does not manifest.

DIagnostic command line output from two ~identical projects, one created in VS:
https://gist.github.com/pjcollins/2f0a47df04a447f6cb46

and one from XS:
https://gist.github.com/pjcollins/fd39dd2c7e1b04882cd0
Comment 14 Peter Collins 2015-05-08 12:00:08 UTC
Created attachment 11132 [details]
project with no warning

Project created in XS that does not reproduce
Comment 15 Peter Collins 2015-05-08 12:00:42 UTC
Created attachment 11133 [details]
project with warning

Project created in VS that displays warning
Comment 16 Jonathan Pryor 2015-05-08 17:17:27 UTC
I don't know how to fix this, but the cause is *hilarious*.

A quick perusal between the VS-generated Attachment #11133 [details] and XS-generated Attachment #11132 [details] shows that Visual Studio's .csproj contains an additional <Import/>:

>    <Import
>        Project="..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets"
>        Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')"
>    />

The contents of the Microsoft.Bcl.Build.targets file? https://gist.github.com/pjcollins/57daded9039f307a3ec3

What's hilarious is line 22:

    <AutoUnifyAssemblyReferences>false</AutoUnifyAssemblyReferences>

Recall from Comment #7 that this was fixed by setting $(AutoUnifyAssemblyReferences) to True. So here comes Microsoft.Bcl.Build.targets to *override* the Xamarin.Android-provided $(AutoUnifyAssemblyReferences) value, explicitly setting it to False...

...which causes the MSB3247 warning to be produced.

(Note also that we will be hitting line 22 because the Condition on line 17 will always be True -- $(TargetFrameworkIdentifier) won't be "Silverlight" and $(OutputType) will always be "Library".)

I thus have no idea how to actually fix this, short of having Visual Studio insert a <PropertyGroup/> *after* the <Import/>, re-setting $(AutoUnifyAssemblyReferences) to True.
Comment 17 Peter Collins 2015-06-03 16:27:32 UTC
This issue should potentially be RESOLVED | UPSTREAM, as it seems as though there isn't anything we'll be able to do to provide a fix for the new failing scenario described in Comment #8 and Comment #13.
Comment 18 cargoxamarin 2015-11-23 19:46:00 UTC
We had been having the same warnings, on VS2014 (14.0.23107.0) and Xamarin.Android 5.1.7.12.

The root cause is in "C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets", target _ResolveSatellitePaths.

<Target Name="_ResolveSatellitePaths"
    DependsOnTargets="_ResolveAssemblies"
>
  <ResolveAssemblyReference
      AllowedAssemblyExtensions="$(AllowedReferenceAssemblyFileExtensions)"
      AssemblyFiles="@(ResolvedUserAssemblies)"
      FindDependencies="True"
      FindRelatedFiles="False"
      FindSatellites="True"
      SearchPaths="$(AssemblySearchPaths)"
      TargetFrameworkMoniker="$(TargetFrameworkMoniker)"
      TargetFrameworkMonikerDisplayName="$(TargetFrameworkMonikerDisplayName)"
      TargetFrameworkDirectories="$(TargetFrameworkDirectory)">
    <Output TaskParameter="SatelliteFiles" ItemName="_AndroidResolvedSatellitePaths"/>
  </ResolveAssemblyReference>

The invocation to ResolveAssemblyReference does not receive an app.config (it should if you have one in the project), or doesn't receive AutoUnify="true" (it should if it gets calculated e.g. from AutoUnifyAssemblyReferences).

If I hack it an add AutoUnify=true to that .targets file, the warnings are gone.

This seems like something that does need fixing, in Xamarin.Android.Common.targets.
Comment 19 Tobias Hoppenthaler 2016-01-07 15:17:17 UTC
I am trying to use System.Net.Http.Primitives.dll, yet I have the problem described in this issue. Is there a way to solve the problem? I looked in 
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets
and found the following from line 199 onwards:

<!-- Prevent warnings about assembly version conflicts -->
	<AutoUnifyAssemblyReferences>True</AutoUnifyAssemblyReferences>
	<AutoGenerateBindingRedirects>False</AutoGenerateBindingRedirects>
	
which seems to already reflect the settings from comment #18, but I still get the error:

Error	10	Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Net.Http.Primitives, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'System.Net.Http.Primitives.dll'
   at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
   at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
   at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
   at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
   at Xamarin.Android.Tasks.ResolveAssemblies.Execute()	Assembly.Droid

Is there a way to fix my problem and if so: how?

Here are my environment details:

Microsoft Visual Studio Professional 2013
Version 12.0.40629.00 Update 5
Microsoft .NET Framework
Version 4.5.51209

Xamarin   4.0.0.1717 (1390b70)
Xamarin.Android   6.0.0.35 (d300845)
Xamarin.iOS   9.3.99.33 (ea30b32)
Comment 20 Dan Edgar 2016-01-08 13:50:37 UTC
I am also seeing Comment #19 when trying to compile a standard MonoDroid project that references an assembly that uses Microsoft.Net.Http v2.2.29

I can probably workaround by having an Android specific assembly that doesn't use Microsoft.Net.Http v2.2.29, but that kind of defeats the purpose of using the portable Microsoft.Net.Http layer in the first place.

The weird part is that this reference did work earlier in the day with no errors, however I am unsure what changed throughout the day to cause the build issue.

My error (same as Comment #19):
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1345,2): error : Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Net.Http.Primitives, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1345,2): error : File name: 'System.Net.Http.Primitives.dll'
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1345,2): error :    at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1345,2): error :    at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1345,2): error :    at Xamarin.Android.Tasks.ResolveAssemblies.Execute()

Thanks in advance for any help.

Environment:

Microsoft Visual Studio Enterprise 2015 14.0.24720.00 Update 1
Xamarin 4.0.0.1717 (1390b70)
Xamarin.Android   6.0.0.35 (d300845)
Xamarin.iOS   9.3.99.33 (ea30b32)
Comment 21 Dan Edgar 2016-01-08 14:04:28 UTC
I believe I have fixed the build error issue from Comment #19 and Comment #20.

First off, you have to install the Microsoft.Bcl.Build 1.0.21 NuGet Package into the MonoAndroid project.

Then you have to bring in the Microsoft.Net.Http 2.2.29 NuGet Package.
This package will then bring in the Microsoft.Bcl 1.1.10 NuGet Package.

It has to be done in this order or you are unable to bring in the Microsoft.Net.Http 2.2.29 NuGet package which resolves the System.Net.Http.Primitives missing DLL build error.

When done your packages.config within your MonoAndroid project should look like:
<packages>
  <package id="Microsoft.Bcl" version="1.1.10" targetFramework="monoandroid50" />
  <package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="monoandroid50" />
  <package id="Microsoft.Net.Http" version="2.2.29" targetFramework="monoandroid50" />
</packages>


You do get warnings due to bad DLL version mappings at build time but those are just warnings.

Good luck.
Comment 22 Thomas Hagström 2016-06-06 14:32:46 UTC
Simply having the right packages does not fix the issue, as I have exactly the above and am sitting with this error now.

However, I was able to resolve the issue by adding the package

System.Net.Http.Formatting.Extension by andre.agostinho
Comment 23 englishguy64 2016-06-13 08:50:09 UTC
Acquaint.Native solution is giving me this error. I can compile Acquaint.XForms ok. 

Comment#21, Comment#22 do not work for me when adding to the Acquanit.Native.Droid project

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.Net.Http" 
culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly></assemblyBinding>	Acquaint.Native.Droid Build
Comment 24 Mikey 2016-10-06 21:50:47 UTC
Creating brand new projects in VS 2015 (update 3) using the built-in Xamarin templates causes this to happen.  Not sure if it's a regression or something else.  But if you create a new "Blank Xaml App (Xamarin.Forms.Portable)" you will get this behavior without adding anything extra or special. :(
Comment 25 Glenn Rockland 2016-10-15 01:24:35 UTC
double-click doesn't fix. :(
Comment 26 Joaquin Jares 2017-06-05 14:18:26 UTC
This issue has evolved into several things. I'll try to separate them:
1. System.Net.Http seems to be resolved, or at least worked around in Comment 21
2. Templates unfolded something that threw warnings. This is now fixed.
3. Other dependency bindings, which should be created as their own issues for proper tracking.

These items (except for 3, which is very broad) are fixed now. I'm marking as fixed. Please if you have a new dependency behavior, create a new issue so we can track it separately.