Skip to content

Instantly share code, notes, and snippets.

@bradwilson
Created August 4, 2015 01:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradwilson/8052811fdba05219bef2 to your computer and use it in GitHub Desktop.
Save bradwilson/8052811fdba05219bef2 to your computer and use it in GitHub Desktop.
Dependency selection logic issues in NuGet v3

Look at these lines in this NUSPEC file:

https://github.com/xunit/xunit/blob/b1cbc40158cc53be5b9150bcdeb2e1cae40db5c9/src/xunit.extensibility.execution.nuspec#L24-L44

They were added because we observed some very unusal behavior. Specifically, note that the libraries are all platform specific (other than portable-win81+wpa81). Without the highlighted lines, this is the observable behavior when referencing this NuGet package:

  • It would link against the platform-specific library (e.g., lib\net45\xunit.execution.desktop.dll)
  • It would pull the dependency list from "dotnet", some of which are clearly not net45 compatible (e.g., System.Runtime 4.0.20)

We originally had a TF-less group, which we assumed would be used by anybody who wasn't "dotnet" or "dnx46":

https://github.com/xunit/xunit/blob/9a8bb1006b72d38e1da70539df3ebd26b53c7aab/src/xunit.extensibility.execution.nuspec#L24-L26

This was later replaced with the duplicated TF-specific groups to prevent the broken behavior.

@bradwilson
Copy link
Author

My expectation of the correct behavior would be that once a target framework is chosen for the library (or reference), that it would use that exact target framework for dependency selection as well, falling back to the TF-less group when there wasn't one specifically for the target framework.

@bradwilson
Copy link
Author

Or, at the very least, not pick dotnet when my project is net45, since the dependencies listed in dotnet are clearly not compatible with net45.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment