Change RID fallback to happen per asset type (dotnet/core-setup#6724)
authorVitek Karas <vitek.karas@microsoft.com>
Mon, 10 Jun 2019 07:37:32 +0000 (00:37 -0700)
committerGitHub <noreply@github.com>
Mon, 10 Jun 2019 07:37:32 +0000 (00:37 -0700)
commit79fc7296598efb5c078e87b9408b8fb93bdec18e
tree6bac5df9e62bb0bf736ca87398e284bb0d831ee7
parent03355dd5b63d512b8243d825cd96721a60d10c0c
Change RID fallback to happen per asset type (dotnet/core-setup#6724)

Previously the hostpolicy would find the best RID match across all assets in a given package. Once it found one, it removed all assets not matching the found RID.

This means that if there's a managed assembly for RID `win` and native library for RID `win-x86`, only the native library would be resolved, the managed assembly would never be used (since it doesn't match exactly the more specific `win-x86` RID).

This is not what NuGet does, NuGet performs the RID fallback per asset type, so native libraries are processed separately from managed assemblies.

This change modifies hostpolicy to match the NuGet behavior. Had to change the data structures which stored package->rid->asset-type. Now it's package->asset-type->rid.

Added test for this case.

Commit migrated from https://github.com/dotnet/core-setup/commit/3f133f51bc6fd73c7b150dcdd9195a2530a4d3b1
src/installer/corehost/cli/deps_format.cpp
src/installer/corehost/cli/deps_format.h
src/installer/test/HostActivationTests/DependencyResolution/DependencyResolutionCommandResultExtensions.cs
src/installer/test/HostActivationTests/DependencyResolution/PortableAppRidAssetResolution.cs