How does NuGet resolve references when both portable and unpromising class libraries are present?

I am working on a portable class library and would like to understand the strategy NuGet uses to determine if it should use a PCL or a platform specific library (if one exists).

I built a sample project that references JSON.NET, which supports various platforms, as well as a portable class library. Here is what NuGet offers JSON.NET:

  • net20
  • net35
  • net40
  • sl3-rub
  • SL4
  • SL4-windowsphone71
  • winrt45
  • portable-net40 + SL4 + WP7 + Win8

First, I created a library targeting NET 4.0, and added a reference to JSON.NET using NuGet. He added a link to the net40 library. Well, I assumed that this is due to the exact match of the target platform. Then I aimed at NET 4.0.3. The version of net40 was also indicated. Then I tried Silverlight 5, which did not have an exact match among non-portable libraries. But the sl4 library was chosen. And for targeting Windows Phone 8, sl4-windowsphone71 was selected in the library.

Thus, whenever there is a non-portable library for the target platform, it will be prioritized. In the case of JSON.NET, the PCL will only be selected if it is referenced by another portable library. If so, I am puzzled by how the following situation will be resolved:

Library A has two versions:

  • net40
  • portable-net40 + SL4 + WP7 + Win8

B A :

  • -net40 + SL4 + WP7 + Win8

, C A, B :

  • net40

lib A, C? C A , net40 A. C B, , A. , net40 A C . ?

UPDATE. , , C A, PCL A. , - lib, () .

+5
1

NuGet " " " " , , .

. . net40 net45 net40. NuGet .NET 4.5, , .NET 4, , .NET 4.5.

, (, ( ) ) API, , API-, , (, API).

+4

All Articles