@@ -20,6 +20,7 @@ namespace Microsoft.DotNet.Build.Tasks
20
20
/// and then update the stage 0 back.
21
21
///
22
22
/// Override NETCoreSdkVersion to stage 0 sdk version like 6.0.100-dev
23
+ /// Override NETCoreSdkRuntimeIdentifier and NETCoreSdkPortableRuntimeIdentifier to match the target RID
23
24
///
24
25
/// Use a task to override since it was generated as a string literal replace anyway.
25
26
/// And using C# can have better error when anything goes wrong.
@@ -37,6 +38,8 @@ public sealed class OverrideAndCreateBundledNETCoreAppPackageVersion : Task
37
38
38
39
[ Required ] public string NewSDKVersion { get ; set ; }
39
40
41
+ [ Required ] public string TargetRid { get ; set ; }
42
+
40
43
[ Required ] public string OutputPath { get ; set ; }
41
44
42
45
public override bool Execute ( )
@@ -46,6 +49,7 @@ public override bool Execute()
46
49
File . ReadAllText ( Stage0MicrosoftNETCoreAppRefPackageVersionPath ) ,
47
50
MicrosoftNETCoreAppRefPackageVersion ,
48
51
NewSDKVersion ,
52
+ TargetRid ,
49
53
Log ) ) ;
50
54
return true ;
51
55
}
@@ -54,6 +58,7 @@ public static string ExecuteInternal(
54
58
string stage0MicrosoftNETCoreAppRefPackageVersionContent ,
55
59
string microsoftNETCoreAppRefPackageVersion ,
56
60
string newSDKVersion ,
61
+ string targetRid ,
57
62
TaskLoggingHelper log = null )
58
63
{
59
64
var projectXml = XDocument . Parse ( stage0MicrosoftNETCoreAppRefPackageVersionContent ) ;
@@ -63,6 +68,8 @@ public static string ExecuteInternal(
63
68
var propertyGroup = projectXml . Root . Elements ( ns + "PropertyGroup" ) . First ( ) ;
64
69
65
70
propertyGroup . Element ( ns + "NETCoreSdkVersion" ) . Value = newSDKVersion ;
71
+ propertyGroup . Element ( ns + "NETCoreSdkRuntimeIdentifier" ) . Value = targetRid ;
72
+ propertyGroup . Element ( ns + "NETCoreSdkPortableRuntimeIdentifier" ) . Value = targetRid ;
66
73
67
74
68
75
var originalBundledNETCoreAppPackageVersion = propertyGroup . Element ( ns + "BundledNETCoreAppPackageVersion" ) . Value ;
0 commit comments