none
Installing NuGet Packages in a Cross-Platform Solution

    Question

  • When installing NuGet packages in a Cross-Platform solution which has a PCL project, is it necessary to always install them to all projects even if they don't have any code which accesses the NuGet package, just the PCL does?

    If you do install per the Management tool to all packages from the solution perspective, are multiple copies used or just a single copy with references placed in the perspective project?

    Is there any general rules or guidelines on this subject?

    TIA, Marc

    Sunday, July 31, 2016 2:37 PM

All replies

  • Hi Marc,

    If your question is related to Xamarin cross platform applications, please post it at  https://forums.xamarin.com/categories/cross-platform

    In every project in the cross platform solution, it uses its own Nuget packages that it needs but there are common package like Xamarin.Forms and AutoMapper and so on.


    Thanks, Mahmoud

    Sunday, July 31, 2016 3:14 PM
  • Even though I am using Xamarin.Forms, the question is not specific to it. I am trying to understand the logic behind the underlying topology and the implementation of that logic as pertains to the libraries themselves, i.e. if every project includes a library from the solutions perspective as compared to the project perspective, how many copies of the library do I end up with in the binaries? Or, if I include a library in the PCL and create a class defined in the PCL that references that library in a project, do I need to include the library in the project's NuGets? 
    Sunday, July 31, 2016 4:17 PM
  • Hi  Marc,

    >>is it necessary to always install them to all projects even if they don't have any code which accesses the NuGet package, just the PCL does?

    As far as I know, you can install the package into your PCL project spearately.  You could refer to the answer in the following thread:

    http://stackoverflow.com/questions/4967651/how-do-i-install-a-nuget-package-into-the-second-project-in-a-solution

    By the way, please take a look at the document about "How to include a NuGet package in a Xamarin Project"

    https://developer.xamarin.com/guides/cross-platform/xamarin-studio/nuget_walkthrough/

    Best Regards,

    Lake Xiao

    Tuesday, August 2, 2016 1:59 AM
    Moderator