For the curious ones, I did find out how to do this via official API. Hell, guys in Redmond should really document their stuff.
First of all, my initial assumption was wrong - package doesn't have a target framework, neither does it's specific version.
I did fairly simply experiment:
var repoBuilder = new PackageRepositoryBuilder();
var aggregateRepository = repoBuilder.BuildRemote();
var mspec = serviceBasedRepository.FindPackagesById("Machine.Specifications").FirstOrDefault(x => x.Version == SemanticVersion.Parse("0.5.12"));
That last line gets a version of MSpec package. If now we query mspec.AssemblyReferences, we'll see 3 items - each with its own target framework (actually filled, this time) and a relative path against packages folder.
It can also happen that the package doesn't have separate binaries for different framework versions - in this case, there'll be an item with target framework = null, residing in \packages\{packageId}.{packageVersion}\lib folder.
Of course, same principles apply if package version contains several assembly references for one runtime - that is, NHibernate at some point consisted of 3 assemblies, Castle, Linq support and NH itself. The item count in AssemblyReferences collection will then be <amountOfReferencedAssemblies>*<amountOfRuntimesSupported>.
вторник, 12 марта 2013 г., 2:53:04 UTC+4 пользователь Gleb Chermennov написал: