@@ -20,6 +20,7 @@ namespace Microsoft.DotNet.Build.Tasks
2020 /// and then update the stage 0 back.
2121 ///
2222 /// Override NETCoreSdkVersion to stage 0 sdk version like 6.0.100-dev
23+ /// Override NETCoreSdkRuntimeIdentifier and NETCoreSdkPortableRuntimeIdentifier to match the target RID
2324 ///
2425 /// Use a task to override since it was generated as a string literal replace anyway.
2526 /// And using C# can have better error when anything goes wrong.
@@ -37,6 +38,8 @@ public sealed class OverrideAndCreateBundledNETCoreAppPackageVersion : Task
3738
3839 [ Required ] public string NewSDKVersion { get ; set ; }
3940
41+ [ Required ] public string TargetRid { get ; set ; }
42+
4043 [ Required ] public string OutputPath { get ; set ; }
4144
4245 public override bool Execute ( )
@@ -46,6 +49,7 @@ public override bool Execute()
4649 File . ReadAllText ( Stage0MicrosoftNETCoreAppRefPackageVersionPath ) ,
4750 MicrosoftNETCoreAppRefPackageVersion ,
4851 NewSDKVersion ,
52+ TargetRid ,
4953 Log ) ) ;
5054 return true ;
5155 }
@@ -54,6 +58,7 @@ public static string ExecuteInternal(
5458 string stage0MicrosoftNETCoreAppRefPackageVersionContent ,
5559 string microsoftNETCoreAppRefPackageVersion ,
5660 string newSDKVersion ,
61+ string targetRid ,
5762 TaskLoggingHelper log = null )
5863 {
5964 var projectXml = XDocument . Parse ( stage0MicrosoftNETCoreAppRefPackageVersionContent ) ;
@@ -63,6 +68,8 @@ public static string ExecuteInternal(
6368 var propertyGroup = projectXml . Root . Elements ( ns + "PropertyGroup" ) . First ( ) ;
6469
6570 propertyGroup . Element ( ns + "NETCoreSdkVersion" ) . Value = newSDKVersion ;
71+ propertyGroup . Element ( ns + "NETCoreSdkRuntimeIdentifier" ) . Value = targetRid ;
72+ propertyGroup . Element ( ns + "NETCoreSdkPortableRuntimeIdentifier" ) . Value = targetRid ;
6673
6774
6875 var originalBundledNETCoreAppPackageVersion = propertyGroup . Element ( ns + "BundledNETCoreAppPackageVersion" ) . Value ;
0 commit comments