.NET Blog

Free. Cross-platform. Open source. A developer platform for building all your apps.

Known Issues using Portable Libraries with the Xamarin tools

This page describes known issues with using Portable Class Libraries (PCL) with the Xamarin tools, and workararounds, where available.

NuGet 2.7.2+ required

Make sure that you are using NuGet 2.7.2 or higher, or just download the latest NuGet for your VS version from the Installing NuGet page.

Referencing the Microsoft.Bcl NuGet Package

You will see a build error if you reference Microsoft.Bcl from a Xamarin iOS or Android project. If you reference Microsoft.Bcl from a Portable Class Library (PCL) that you reference from a Xamarin app project, you will be instructed to also reference Microsoft.Bcl from the app project. You will see an error message similar to the following text.

C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1695,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.

c:\demo\packages\Microsoft.Bcl.1.1.6\lib\portable-net40+win8\System.IO.dll : error CS1703: An assembly with the same identity ‘System.IO, Version=2.6.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ has already been imported. Try removing one of the duplicate references.

c:\demo\packages\Microsoft.Bcl.1.1.6\lib\portable-net40+win8\System.Runtime.dll : error CS1703: An assembly with the same identity ‘System.Runtime, Version=2.6.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ has already been imported. Try removing one of the duplicate references.

c:\demo\packages\Microsoft.Bcl.1.1.6\lib\portable-net40+win8\System.Threading.Tasks.dll : error CS1703: An assembly with the same identity ‘System.Threading.Tasks, Version=2.6.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ has already been imported. Try removing one of the duplicate references.

To resolve this issue, remove the following references from your app project. You will be able to build at that point.

  • System.Runtime
  • System.IO
  • System.Threading.Tasks

This issue will be fixed in a future NuGet client update.