@@ -112,6 +112,8 @@ public class ProcessFrameworkReferences : TaskBase
112
112
[ Required ]
113
113
public string NETCoreSdkRuntimeIdentifier { get ; set ; }
114
114
115
+ public string NETCoreSdkPortableRuntimeIdentifier { get ; set ; }
116
+
115
117
[ Required ]
116
118
public string NetCoreRoot { get ; set ; }
117
119
@@ -778,9 +780,17 @@ private ToolPackSupport AddToolPack(
778
780
var packNamePattern = knownPack . GetMetadata ( packName + "PackNamePattern" ) ;
779
781
var packSupportedRuntimeIdentifiers = knownPack . GetMetadata ( packName + "RuntimeIdentifiers" ) . Split ( ';' ) ;
780
782
783
+ // When publishing for the non-portable RID that matches NETCoreSdkRuntimeIdentifier, prefer NETCoreSdkRuntimeIdentifier for the host.
784
+ // Otherwise prefer the NETCoreSdkPortableRuntimeIdentifier.
785
+ // This makes non-portable SDKs behave the same as portable SDKs except for the specific case of targetting the non-portable RID.
786
+ // It also enables the non-portable ILCompiler to be packaged separately from the SDK and
787
+ // only required when publishing for the non-portable SDK RID.
788
+ string portableSdkRid = ! string . IsNullOrEmpty ( NETCoreSdkPortableRuntimeIdentifier ) ? NETCoreSdkPortableRuntimeIdentifier : NETCoreSdkRuntimeIdentifier ;
789
+ bool targetsNonPortableSdkRid = RuntimeIdentifier == NETCoreSdkRuntimeIdentifier && NETCoreSdkRuntimeIdentifier != portableSdkRid ;
790
+ string hostRuntimeIdentifier = targetsNonPortableSdkRid ? NETCoreSdkRuntimeIdentifier : portableSdkRid ;
781
791
// Get the best RID for the host machine, which will be used to validate that we can run crossgen for the target platform and architecture
782
792
var runtimeGraph = new RuntimeGraphCache ( this ) . GetRuntimeGraph ( RuntimeGraphPath ) ;
783
- var hostRuntimeIdentifier = NuGetUtils . GetBestMatchingRid ( runtimeGraph , NETCoreSdkRuntimeIdentifier , packSupportedRuntimeIdentifiers , out bool wasInGraph ) ;
793
+ hostRuntimeIdentifier = NuGetUtils . GetBestMatchingRid ( runtimeGraph , hostRuntimeIdentifier , packSupportedRuntimeIdentifiers , out bool wasInGraph ) ;
784
794
if ( hostRuntimeIdentifier == null )
785
795
{
786
796
return ToolPackSupport . UnsupportedForHostRuntimeIdentifier ;
0 commit comments