From d703ca2773927e68ec8c6b1b27c742ab827c0c88 Mon Sep 17 00:00:00 2001
From: Chris Ross <chrross@microsoft.com>
Date: Fri, 1 Oct 2021 10:56:26 -0700
Subject: [PATCH 01/16] Update SDK to 7.0.100-alpha.1.21480.20

---
 global.json | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/global.json b/global.json
index e91da934a604..5808b048a8fb 100644
--- a/global.json
+++ b/global.json
@@ -1,9 +1,9 @@
 {
   "sdk": {
-    "version": "7.0.100-alpha.1.21474.3"
+    "version": "7.0.100-alpha.1.21480.20"
   },
   "tools": {
-    "dotnet": "7.0.100-alpha.1.21474.3",
+    "dotnet": "7.0.100-alpha.1.21480.20",
     "runtimes": {
       "dotnet/x64": [
         "2.1.27",

From 41c52624a0ecc75fc09d01a59f9f2818667266ab Mon Sep 17 00:00:00 2001
From: Chris R <Tratcher@outlook.com>
Date: Fri, 1 Oct 2021 11:22:04 -0700
Subject: [PATCH 02/16] EnablePreviewFeatures in Transport.Quic

---
 .../Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.csproj   | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/Servers/Kestrel/Transport.Quic/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.csproj b/src/Servers/Kestrel/Transport.Quic/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.csproj
index a1838ce726b8..7e7e858fd86b 100644
--- a/src/Servers/Kestrel/Transport.Quic/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.csproj
+++ b/src/Servers/Kestrel/Transport.Quic/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.csproj
@@ -10,6 +10,8 @@
     <NoWarn>CA1416;CS1591;CS0436;$(NoWarn)</NoWarn><!-- Conflicts between internal and public Quic APIs; Platform support warnings. -->
     <IsPackable>false</IsPackable>
     <Nullable>enable</Nullable>
+    <!-- Turn on preview features so we can use Quic -->
+    <EnablePreviewFeatures>True</EnablePreviewFeatures>
   </PropertyGroup>
 
   <ItemGroup>

From 37f9ce14dc4b2d0c73085c060c66287e2884f745 Mon Sep 17 00:00:00 2001
From: Chris R <Tratcher@outlook.com>
Date: Fri, 1 Oct 2021 14:02:17 -0700
Subject: [PATCH 03/16] Remove RequiresPreviewFeatures

---
 src/Servers/Kestrel/Core/src/HttpProtocols.cs                | 5 -----
 ...Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.csproj | 2 --
 .../Kestrel/Transport.Quic/src/QuicTransportOptions.cs       | 1 -
 .../Transport.Quic/src/WebHostBuilderQuicExtensions.cs       | 2 --
 4 files changed, 10 deletions(-)

diff --git a/src/Servers/Kestrel/Core/src/HttpProtocols.cs b/src/Servers/Kestrel/Core/src/HttpProtocols.cs
index bba5af680ee5..f8bdc7e86619 100644
--- a/src/Servers/Kestrel/Core/src/HttpProtocols.cs
+++ b/src/Servers/Kestrel/Core/src/HttpProtocols.cs
@@ -1,9 +1,6 @@
 // Licensed to the .NET Foundation under one or more agreements.
 // The .NET Foundation licenses this file to you under the MIT license.
 
-using System;
-using System.Runtime.Versioning;
-
 namespace Microsoft.AspNetCore.Server.Kestrel.Core
 {
     /// <summary>
@@ -16,9 +13,7 @@ public enum HttpProtocols
         Http1 = 0x1,
         Http2 = 0x2,
         Http1AndHttp2 = Http1 | Http2,
-        [RequiresPreviewFeatures("Kestrel HTTP/3 support for .NET 6 is in preview.", Url = "https://aka.ms/aspnet/kestrel/http3reqs")]
         Http3 = 0x4,
-        [RequiresPreviewFeatures("Kestrel HTTP/3 support for .NET 6 is in preview.", Url = "https://aka.ms/aspnet/kestrel/http3reqs")]
         Http1AndHttp2AndHttp3 = Http1 | Http2 | Http3
     }
 }
diff --git a/src/Servers/Kestrel/Transport.Quic/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.csproj b/src/Servers/Kestrel/Transport.Quic/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.csproj
index 7e7e858fd86b..a1838ce726b8 100644
--- a/src/Servers/Kestrel/Transport.Quic/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.csproj
+++ b/src/Servers/Kestrel/Transport.Quic/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.csproj
@@ -10,8 +10,6 @@
     <NoWarn>CA1416;CS1591;CS0436;$(NoWarn)</NoWarn><!-- Conflicts between internal and public Quic APIs; Platform support warnings. -->
     <IsPackable>false</IsPackable>
     <Nullable>enable</Nullable>
-    <!-- Turn on preview features so we can use Quic -->
-    <EnablePreviewFeatures>True</EnablePreviewFeatures>
   </PropertyGroup>
 
   <ItemGroup>
diff --git a/src/Servers/Kestrel/Transport.Quic/src/QuicTransportOptions.cs b/src/Servers/Kestrel/Transport.Quic/src/QuicTransportOptions.cs
index 4078b31259ba..56be5eb480bf 100644
--- a/src/Servers/Kestrel/Transport.Quic/src/QuicTransportOptions.cs
+++ b/src/Servers/Kestrel/Transport.Quic/src/QuicTransportOptions.cs
@@ -12,7 +12,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Quic
     /// <summary>
     /// Options for Quic based connections.
     /// </summary>
-    [RequiresPreviewFeatures("Kestrel HTTP/3 support for .NET 6 is in preview.", Url = "https://aka.ms/aspnet/kestrel/http3reqs")]
     public class QuicTransportOptions
     {
         /// <summary>
diff --git a/src/Servers/Kestrel/Transport.Quic/src/WebHostBuilderQuicExtensions.cs b/src/Servers/Kestrel/Transport.Quic/src/WebHostBuilderQuicExtensions.cs
index 18065026f0c2..ff3f49aad273 100644
--- a/src/Servers/Kestrel/Transport.Quic/src/WebHostBuilderQuicExtensions.cs
+++ b/src/Servers/Kestrel/Transport.Quic/src/WebHostBuilderQuicExtensions.cs
@@ -15,7 +15,6 @@ namespace Microsoft.AspNetCore.Hosting
     /// </summary>
     public static class WebHostBuilderQuicExtensions
     {
-        [RequiresPreviewFeatures("Kestrel HTTP/3 support for .NET 6 is in preview.", Url = "https://aka.ms/aspnet/kestrel/http3reqs")]
         public static IWebHostBuilder UseQuic(this IWebHostBuilder hostBuilder)
         {
             if (QuicImplementationProviders.Default.IsSupported)
@@ -29,7 +28,6 @@ public static IWebHostBuilder UseQuic(this IWebHostBuilder hostBuilder)
             return hostBuilder;
         }
 
-        [RequiresPreviewFeatures("Kestrel HTTP/3 support for .NET 6 is in preview.", Url = "https://aka.ms/aspnet/kestrel/http3reqs")]
         public static IWebHostBuilder UseQuic(this IWebHostBuilder hostBuilder, Action<QuicTransportOptions> configureOptions)
         {
             return hostBuilder.UseQuic().ConfigureServices(services =>

From 3b7f281e39914ac7bb904ec74c8c0c96d77553ae Mon Sep 17 00:00:00 2001
From: Chris Ross <chrross@microsoft.com>
Date: Fri, 1 Oct 2021 15:29:36 -0700
Subject: [PATCH 04/16] Update RunTests.csproj

---
 eng/helix/content/RunTests/RunTests.csproj | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eng/helix/content/RunTests/RunTests.csproj b/eng/helix/content/RunTests/RunTests.csproj
index db5888e80343..486e4bb10748 100644
--- a/eng/helix/content/RunTests/RunTests.csproj
+++ b/eng/helix/content/RunTests/RunTests.csproj
@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <OutputType>Exe</OutputType>
-    <TargetFramework>net6.0</TargetFramework>
+    <TargetFramework>net7.0</TargetFramework>
     <DefineConstants Condition=" '$(InstallPlaywright)' == 'true' ">$(DefineConstants);INSTALLPLAYWRIGHT</DefineConstants>
   </PropertyGroup>
 

From e045062bcb7d8a62e96130ec325595c8d26e63a3 Mon Sep 17 00:00:00 2001
From: Chris R <Tratcher@outlook.com>
Date: Mon, 4 Oct 2021 10:19:19 -0700
Subject: [PATCH 05/16] Use DefaultNetCoreTargetFramework

---
 eng/helix/content/RunTests/RunTests.csproj | 2 +-
 eng/tools/RepoTasks/RepoTasks.csproj       | 3 +--
 eng/tools/RepoTasks/RepoTasks.tasks        | 3 +--
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/eng/helix/content/RunTests/RunTests.csproj b/eng/helix/content/RunTests/RunTests.csproj
index 486e4bb10748..5d3eb5e2da12 100644
--- a/eng/helix/content/RunTests/RunTests.csproj
+++ b/eng/helix/content/RunTests/RunTests.csproj
@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <OutputType>Exe</OutputType>
-    <TargetFramework>net7.0</TargetFramework>
+    <TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
     <DefineConstants Condition=" '$(InstallPlaywright)' == 'true' ">$(DefineConstants);INSTALLPLAYWRIGHT</DefineConstants>
   </PropertyGroup>
 
diff --git a/eng/tools/RepoTasks/RepoTasks.csproj b/eng/tools/RepoTasks/RepoTasks.csproj
index 5e495d347b30..ab46c2052c24 100644
--- a/eng/tools/RepoTasks/RepoTasks.csproj
+++ b/eng/tools/RepoTasks/RepoTasks.csproj
@@ -1,7 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
-    <!-- Keep this project at net6.0 until there is an SDK with net7.0 runtimes -->
-    <TargetFrameworks>net6.0</TargetFrameworks>
+    <TargetFrameworks>$(DefaultNetCoreTargetFramework)</TargetFrameworks>
     <TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net472</TargetFrameworks>
     <DefineConstants Condition="'$(TargetFramework)' == 'net472'">$(DefineConstants);BUILD_MSI_TASKS</DefineConstants>
     <Optimize>false</Optimize>
diff --git a/eng/tools/RepoTasks/RepoTasks.tasks b/eng/tools/RepoTasks/RepoTasks.tasks
index 7483f6e41aae..788558c3fa4c 100644
--- a/eng/tools/RepoTasks/RepoTasks.tasks
+++ b/eng/tools/RepoTasks/RepoTasks.tasks
@@ -1,7 +1,6 @@
 <Project>
   <PropertyGroup>
-    <!-- Keep this project at net6.0 until there is an SDK with net7.0 runtimes -->
-    <_RepoTaskAssemblyFolder Condition="'$(MSBuildRuntimeType)' == 'core'">net6.0</_RepoTaskAssemblyFolder>
+    <_RepoTaskAssemblyFolder Condition="'$(MSBuildRuntimeType)' == 'core'">$(DefaultNetCoreTargetFramework)</_RepoTaskAssemblyFolder>
     <_RepoTaskAssemblyFolder Condition="'$(MSBuildRuntimeType)' != 'core'">net472</_RepoTaskAssemblyFolder>
     <_RepoTaskAssembly>$(ArtifactsBinDir)RepoTasks\Release\$(_RepoTaskAssemblyFolder)\RepoTasks.dll</_RepoTaskAssembly>
   </PropertyGroup>

From ab087e1e52e7ea2b7a58b37f378df9cb43697c0d Mon Sep 17 00:00:00 2001
From: Chris R <Tratcher@outlook.com>
Date: Mon, 4 Oct 2021 10:55:56 -0700
Subject: [PATCH 06/16] More DefaultNetCoreTargetFramework

---
 eng/tools/RepoTasks/RepoTasks.csproj | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/eng/tools/RepoTasks/RepoTasks.csproj b/eng/tools/RepoTasks/RepoTasks.csproj
index ab46c2052c24..67e01850f836 100644
--- a/eng/tools/RepoTasks/RepoTasks.csproj
+++ b/eng/tools/RepoTasks/RepoTasks.csproj
@@ -19,8 +19,7 @@
     <PackageReference Include="Microsoft.Extensions.DependencyModel" Version="$(MicrosoftExtensionsDependencyModelVersion)" />
   </ItemGroup>
 
-  <!-- Change this back to '$(DefaultNetCoreTargetFramework)' once we have an SDK with net7.0 runtimes -->
-  <ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
+  <ItemGroup Condition="'$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)'">
     <PackageReference Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildFrameworkVersion)" />
     <PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildTaskCoreVersion)" />
     <PackageReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildUtilitiesCoreVersion)" />

From 5982858c171667f6215ea34e1229bf5b6879b2dd Mon Sep 17 00:00:00 2001
From: Chris R <Tratcher@outlook.com>
Date: Mon, 4 Oct 2021 12:47:36 -0700
Subject: [PATCH 07/16] centos7

---
 eng/docker/rhel.Dockerfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eng/docker/rhel.Dockerfile b/eng/docker/rhel.Dockerfile
index d42ab7b38993..21983210ed61 100644
--- a/eng/docker/rhel.Dockerfile
+++ b/eng/docker/rhel.Dockerfile
@@ -1,5 +1,5 @@
 # Dockerfile that creates a container suitable to build dotnet-cli
-FROM mcr.microsoft.com/dotnet-buildtools/prereqs:rhel-7-rpmpkg-e1b4a89-20175311035359
+FROM mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-rpmpkg-20210714125435-9b5bbc2
 
 # Setup User to match Host User, and give superuser permissions
 ARG USER

From 9671ae3dde69a96cb3d1f977b07c666053504229 Mon Sep 17 00:00:00 2001
From: Chris R <Tratcher@outlook.com>
Date: Mon, 4 Oct 2021 12:55:01 -0700
Subject: [PATCH 08/16] Less DefaultNetCoreTargetFramework

---
 eng/helix/content/RunTests/RunTests.csproj | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eng/helix/content/RunTests/RunTests.csproj b/eng/helix/content/RunTests/RunTests.csproj
index 5d3eb5e2da12..486e4bb10748 100644
--- a/eng/helix/content/RunTests/RunTests.csproj
+++ b/eng/helix/content/RunTests/RunTests.csproj
@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <OutputType>Exe</OutputType>
-    <TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
+    <TargetFramework>net7.0</TargetFramework>
     <DefineConstants Condition=" '$(InstallPlaywright)' == 'true' ">$(DefineConstants);INSTALLPLAYWRIGHT</DefineConstants>
   </PropertyGroup>
 

From 6b222ccfd27120ab07ddc131adfee7356589cca8 Mon Sep 17 00:00:00 2001
From: Tanay Parikh <TanayParikh@users.noreply.github.com>
Date: Tue, 5 Oct 2021 17:11:10 -0700
Subject: [PATCH 09/16] Update eng/docker/rhel.Dockerfile

---
 eng/docker/rhel.Dockerfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eng/docker/rhel.Dockerfile b/eng/docker/rhel.Dockerfile
index 21983210ed61..ba7962b8abf0 100644
--- a/eng/docker/rhel.Dockerfile
+++ b/eng/docker/rhel.Dockerfile
@@ -1,5 +1,5 @@
 # Dockerfile that creates a container suitable to build dotnet-cli
-FROM mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-rpmpkg-20210714125435-9b5bbc2
+FROM mcr.microsoft.com/dotnet-buildtools/prereqs:centos-8-rpmpkg-20210714125410-daa5116
 
 # Setup User to match Host User, and give superuser permissions
 ARG USER

From a0d559319c7cc9e6dda2708d0b4ce4af73fe30c5 Mon Sep 17 00:00:00 2001
From: Pranav K <prkrishn@hotmail.com>
Date: Thu, 7 Oct 2021 11:50:58 -0700
Subject: [PATCH 10/16] Use CentOS 7 image

---
 eng/docker/rhel.Dockerfile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/eng/docker/rhel.Dockerfile b/eng/docker/rhel.Dockerfile
index ba7962b8abf0..7641c2a12f3f 100644
--- a/eng/docker/rhel.Dockerfile
+++ b/eng/docker/rhel.Dockerfile
@@ -1,5 +1,5 @@
 # Dockerfile that creates a container suitable to build dotnet-cli
-FROM mcr.microsoft.com/dotnet-buildtools/prereqs:centos-8-rpmpkg-20210714125410-daa5116
+FROM mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-rpmpkg-20210714125435-9b5bbc2
 
 # Setup User to match Host User, and give superuser permissions
 ARG USER
@@ -22,3 +22,6 @@ USER $USER_ID
 
 # Skip package initilization
 ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
+
+# Workaround per https://github.com/dotnet/aspnetcore/pull/37192#issuecomment-936589233
+RUN scl enable rh-ruby25

From 273a50bbdd2502f463809064c1474d653e2445fc Mon Sep 17 00:00:00 2001
From: Pranav K <prkrishn@hotmail.com>
Date: Thu, 7 Oct 2021 14:17:34 -0700
Subject: [PATCH 11/16] Update eng/docker/rhel.Dockerfile

---
 eng/docker/rhel.Dockerfile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/eng/docker/rhel.Dockerfile b/eng/docker/rhel.Dockerfile
index 7641c2a12f3f..6b075be1ecd2 100644
--- a/eng/docker/rhel.Dockerfile
+++ b/eng/docker/rhel.Dockerfile
@@ -24,4 +24,7 @@ USER $USER_ID
 ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
 
 # Workaround per https://github.com/dotnet/aspnetcore/pull/37192#issuecomment-936589233
-RUN scl enable rh-ruby25
+RUN yum --enablerepo=centos-sclo-rh -y install rh-ruby25
+RUN echo #!/bin/bash > /etc/profile.d/rh-ruby25.sh
+RUN echo source /opt/rh/rh-ruby25/enable >> /etc/profile.d/rh-ruby25.sh
+RUN echo export X_SCLS="`scl enable rh-ruby25 'echo $X_SCLS'`" >> /etc/profile.d/rh-ruby25.sh

From 5cebe3e533ed8d2adcbe5c14a3463c8a8ffe6971 Mon Sep 17 00:00:00 2001
From: Pranav K <prkrishn@hotmail.com>
Date: Thu, 7 Oct 2021 14:18:13 -0700
Subject: [PATCH 12/16] Update eng/docker/rhel.Dockerfile

---
 eng/docker/rhel.Dockerfile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/eng/docker/rhel.Dockerfile b/eng/docker/rhel.Dockerfile
index 6b075be1ecd2..952f011bc139 100644
--- a/eng/docker/rhel.Dockerfile
+++ b/eng/docker/rhel.Dockerfile
@@ -24,7 +24,7 @@ USER $USER_ID
 ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
 
 # Workaround per https://github.com/dotnet/aspnetcore/pull/37192#issuecomment-936589233
-RUN yum --enablerepo=centos-sclo-rh -y install rh-ruby25
-RUN echo #!/bin/bash > /etc/profile.d/rh-ruby25.sh
-RUN echo source /opt/rh/rh-ruby25/enable >> /etc/profile.d/rh-ruby25.sh
-RUN echo export X_SCLS="`scl enable rh-ruby25 'echo $X_SCLS'`" >> /etc/profile.d/rh-ruby25.sh
+RUN echo -e "#!/bin/bash\n\
+source /opt/rh/rh-ruby25/enable\n\
+export X_SCLS=\"`scl enable rh-ruby25 'echo $X_SCLS'`\"\n" >> /etc/profile.d/rh-ruby25.sh
+

From 979089b7e40873da65cf9b84e3ee07c82685817a Mon Sep 17 00:00:00 2001
From: Pranav K <prkrishn@hotmail.com>
Date: Thu, 7 Oct 2021 15:28:47 -0700
Subject: [PATCH 13/16] Update eng/docker/rhel.Dockerfile

---
 eng/docker/rhel.Dockerfile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/eng/docker/rhel.Dockerfile b/eng/docker/rhel.Dockerfile
index 952f011bc139..137dd3b0f7ae 100644
--- a/eng/docker/rhel.Dockerfile
+++ b/eng/docker/rhel.Dockerfile
@@ -24,6 +24,7 @@ USER $USER_ID
 ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
 
 # Workaround per https://github.com/dotnet/aspnetcore/pull/37192#issuecomment-936589233
+RUN yum --enablerepo=centos-sclo-rh -y install rh-ruby25
 RUN echo -e "#!/bin/bash\n\
 source /opt/rh/rh-ruby25/enable\n\
 export X_SCLS=\"`scl enable rh-ruby25 'echo $X_SCLS'`\"\n" >> /etc/profile.d/rh-ruby25.sh

From c54faee34148d586dc578f6808c17849a78a6ec3 Mon Sep 17 00:00:00 2001
From: Pranav K <prkrishn@hotmail.com>
Date: Thu, 7 Oct 2021 16:33:34 -0700
Subject: [PATCH 14/16] Run yum while root

---
 eng/docker/rhel.Dockerfile | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/eng/docker/rhel.Dockerfile b/eng/docker/rhel.Dockerfile
index 137dd3b0f7ae..c7395eddc6e5 100644
--- a/eng/docker/rhel.Dockerfile
+++ b/eng/docker/rhel.Dockerfile
@@ -9,6 +9,12 @@ ARG WORKDIR
 
 WORKDIR ${WORKDIR}
 
+# Workaround per https://github.com/dotnet/aspnetcore/pull/37192#issuecomment-936589233
+RUN yum --enablerepo=centos-sclo-rh -y install rh-ruby25
+RUN echo -e "#!/bin/bash\n\
+source /opt/rh/rh-ruby25/enable\n\
+export X_SCLS=\"`scl enable rh-ruby25 'echo $X_SCLS'`\"\n" >> /etc/profile.d/rh-ruby25.sh
+
 RUN useradd -m ${USER} --uid ${USER_ID} -g root
 RUN echo '${USER} ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
 
@@ -22,10 +28,3 @@ USER $USER_ID
 
 # Skip package initilization
 ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
-
-# Workaround per https://github.com/dotnet/aspnetcore/pull/37192#issuecomment-936589233
-RUN yum --enablerepo=centos-sclo-rh -y install rh-ruby25
-RUN echo -e "#!/bin/bash\n\
-source /opt/rh/rh-ruby25/enable\n\
-export X_SCLS=\"`scl enable rh-ruby25 'echo $X_SCLS'`\"\n" >> /etc/profile.d/rh-ruby25.sh
-

From 685b12591d10a421a26ffdd28ac25831d396a1a2 Mon Sep 17 00:00:00 2001
From: Pranav K <prkrishn@hotmail.com>
Date: Fri, 8 Oct 2021 10:47:27 -0700
Subject: [PATCH 15/16] Cool surgery

---
 eng/docker/rhel.Dockerfile | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/eng/docker/rhel.Dockerfile b/eng/docker/rhel.Dockerfile
index c7395eddc6e5..48882bee0088 100644
--- a/eng/docker/rhel.Dockerfile
+++ b/eng/docker/rhel.Dockerfile
@@ -10,7 +10,13 @@ ARG WORKDIR
 WORKDIR ${WORKDIR}
 
 # Workaround per https://github.com/dotnet/aspnetcore/pull/37192#issuecomment-936589233
+RUN gem uninstall fpm
+RUN yum remove -y rubygems
+RUN yum remove -y ruby-devel
 RUN yum --enablerepo=centos-sclo-rh -y install rh-ruby25
+RUN yum --enablerepo=centos-sclo-rh -y install rh-ruby25-ruby-devel
+RUN yum --enablerepo=centos-sclo-rh -y install rh-ruby25-rubygems
+RUN scl enable rh-ruby25 'gem install --no-document fpm'
 RUN echo -e "#!/bin/bash\n\
 source /opt/rh/rh-ruby25/enable\n\
 export X_SCLS=\"`scl enable rh-ruby25 'echo $X_SCLS'`\"\n" >> /etc/profile.d/rh-ruby25.sh

From d826016bc4728bfb4c3d898c431690c6fb7134db Mon Sep 17 00:00:00 2001
From: Pranav K <prkrishn@hotmail.com>
Date: Fri, 8 Oct 2021 11:45:09 -0700
Subject: [PATCH 16/16] WIP

---
 eng/docker/rhel.Dockerfile                 | 3 ---
 src/Installers/Rpm/Directory.Build.targets | 2 +-
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/eng/docker/rhel.Dockerfile b/eng/docker/rhel.Dockerfile
index 48882bee0088..61d42539e8f4 100644
--- a/eng/docker/rhel.Dockerfile
+++ b/eng/docker/rhel.Dockerfile
@@ -17,9 +17,6 @@ RUN yum --enablerepo=centos-sclo-rh -y install rh-ruby25
 RUN yum --enablerepo=centos-sclo-rh -y install rh-ruby25-ruby-devel
 RUN yum --enablerepo=centos-sclo-rh -y install rh-ruby25-rubygems
 RUN scl enable rh-ruby25 'gem install --no-document fpm'
-RUN echo -e "#!/bin/bash\n\
-source /opt/rh/rh-ruby25/enable\n\
-export X_SCLS=\"`scl enable rh-ruby25 'echo $X_SCLS'`\"\n" >> /etc/profile.d/rh-ruby25.sh
 
 RUN useradd -m ${USER} --uid ${USER_ID} -g root
 RUN echo '${USER} ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
diff --git a/src/Installers/Rpm/Directory.Build.targets b/src/Installers/Rpm/Directory.Build.targets
index cc13e2801dd9..964ab6c4c30f 100644
--- a/src/Installers/Rpm/Directory.Build.targets
+++ b/src/Installers/Rpm/Directory.Build.targets
@@ -77,7 +77,7 @@
       <FpmArgs Include="&quot;$(PackageContentRoot)=$(RpmPackageInstallRoot)&quot;" />
     </ItemGroup>
 
-    <Exec Command="fpm @(FpmArgs,' ')" />
+    <Exec Command="scl enable rh-ruby25 'fpm @(FpmArgs,' ')'" />
 
     <Copy SourceFiles="$(TargetPath)"
           DestinationFiles="$(CblMarinerTargetPath)"