In software development there is always, and I mean always, something that will turn that sincere joy of coding into a living nightmare and when you’re starting a new project you can be sure that it has something to do with package management, dependencies and versioning of those dependencies. It might be those Cocoapods, those Maven artifacts or in this case: NuGet packages.
This weekend I was coding on a project using the real-time framework SignalR and so I wanted to use the client libraries that existed for .NET. The SignalR Client package works on most if not all the platforms, but it has a couple of dependencies that might fail to install.
It seems that if you try to install the package Microsoft.Net.Http on a Xamarin iOS or Android project you can get these kinds of messages popping up:
Could not install package ‘Microsoft.Bcl.Build 1.0.14’. You are trying to install this package into a project that targets ‘Xamarin.iOS,Version=v1.0’, but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
Could not find
System.Net.Http.Extensionsreferenced by assembly
Microsoft.AspNet.SignalR.Client, Version=18.104.22.168, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
The Microsoft.Net.Http package has dependencies on the Microsoft.Bcl and Microsoft.Bcl.Build packages, and the culprit will be the Microsoft.Bcl.Build package.
After a while of swearing at the NuGet package manager and wishing I’d take other choices in my life I tried installing the dependencies manually.
Turns out Microsoft.Bcl.Build has a newer package than 1.0.14 that supports the latest and greatest bits from Xamarin, and for some reason the Microsoft.Net.Http package does not know about it or hasn’t been updated to reference the newest one.
If you’re having similar problems then try to install the dependencies manually because you never know, it might just work..