0

It is possible to use NET Standard libraries in Xamarin.Android projects. But since Xamarin.Android projects do not use project.json yet, all dependencies of included NET Standard libraries are lost. While there is the same problem with NET Framework apps, there is a VS extensions "Nuget package to project.json converter" which converts projects to use project.json And is works perfectly for NET Framework apps while Xamarin.Android project does not build after conversion.

As a workaround, dependencies can be added to Xamarin.Android project manually.

Is there a better way at the moment to use NET Standard libs in Xamarin.Android projects in a convenient way?

Athari
  • 33,702
  • 16
  • 105
  • 146
  • The system of project.json is dead. Xamarin will soon ship a new version to complete .NET Standard support, which should have already landed in beta channel. Have you checked that out? – Lex Li Jan 16 '17 at 02:50
  • Can you explain what `all dependencies of included NET Standard libraries are lost` mean in more detail? You should be able to use .NET Standard libraries with Android when it is using a packages.config file. The main problem is making sure particular dependencies are installed with a high enough version. Also what are the errors when you build an Android project after converting to project.json? – Matt Ward Jan 16 '17 at 16:43
  • To add to what Lex Li has already put. Xamarin Studio 6.2 allows you to convert a PCL project to a .NET Standard Library project. It uses a project.json file. You should be able to reference this .NET Standard Library project from the Android project. – Matt Ward Jan 16 '17 at 16:47
  • I can reference NET Standard library project from Android project, but if NET Standard Lib Project depends on some library (for instance JSON.NET), Android project won't discover those dependencies and will fail during the runtime due to "cannot find assembly". Same time it works fine with UWP projects. Since UWP use project.json too, NuGet is able to correctly resolve dependencies of referenced libs. – Vitaliy Nesterenko Jan 16 '17 at 17:29
  • this may be a helpful link in your case https://xamarinhelp.com/dot-net-standard-pcl-xamarin-forms/ – Yogesh Mar 20 '17 at 12:42

0 Answers0