diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.Common/LanguageSupport/CompilerFeatureRequiredAttribute.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.Common/LanguageSupport/CompilerFeatureRequiredAttribute.cs
new file mode 100644
index 0000000000..8260811875
--- /dev/null
+++ b/src/Razor/src/Microsoft.AspNetCore.Razor.Common/LanguageSupport/CompilerFeatureRequiredAttribute.cs
@@ -0,0 +1,32 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the MIT license. See License.txt in the project root for license information.
+
+// Copied from https://github/dotnet/runtime
+
+#if !NET7_0_OR_GREATER
+
+namespace System.Runtime.CompilerServices;
+
+///
+/// Indicates that compiler support for a particular feature is required for the location where this attribute is applied.
+///
+[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
+internal sealed class CompilerFeatureRequiredAttribute : Attribute
+{
+ public CompilerFeatureRequiredAttribute(string featureName)
+ {
+ FeatureName = featureName;
+ }
+
+ ///
+ /// The name of the compiler feature.
+ ///
+ public string FeatureName { get; }
+
+ ///
+ /// If true, the compiler can choose to allow access to the location where this attribute is applied if it does not understand .
+ ///
+ public bool IsOptional { get; init; }
+}
+
+#endif
diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.Common/LanguageSupport/RequiredMemberAttribute.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.Common/LanguageSupport/RequiredMemberAttribute.cs
new file mode 100644
index 0000000000..b4c000a2d0
--- /dev/null
+++ b/src/Razor/src/Microsoft.AspNetCore.Razor.Common/LanguageSupport/RequiredMemberAttribute.cs
@@ -0,0 +1,14 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the MIT license. See License.txt in the project root for license information.
+
+// Copied from https://github/dotnet/runtime
+
+#if !NET7_0_OR_GREATER
+
+namespace System.Runtime.CompilerServices;
+
+/// Specifies that a type has required members or that a member is required.
+[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
+internal sealed class RequiredMemberAttribute : Attribute { }
+
+#endif
diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.Common/LanguageSupport/SetsRequiredMembersAttribute.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.Common/LanguageSupport/SetsRequiredMembersAttribute.cs
new file mode 100644
index 0000000000..0dc8352700
--- /dev/null
+++ b/src/Razor/src/Microsoft.AspNetCore.Razor.Common/LanguageSupport/SetsRequiredMembersAttribute.cs
@@ -0,0 +1,17 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the MIT license. See License.txt in the project root for license information.
+
+// Copied from https://github/dotnet/runtime
+
+#if !NET7_0_OR_GREATER
+
+namespace System.Diagnostics.CodeAnalysis;
+
+///
+/// Specifies that this constructor sets all required members for the current type, and callers
+/// do not need to set any required members themselves.
+///
+[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
+internal sealed class SetsRequiredMembersAttribute : Attribute { }
+
+#endif
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/RequiredAttributes.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/RequiredAttributes.cs
deleted file mode 100644
index 8559189646..0000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/RequiredAttributes.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the MIT license. See License.txt in the project root for license information.
-
-#if !NETCOREAPP
-namespace System.Runtime.CompilerServices
-{
- [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Field | AttributeTargets.Property, Inherited = false, AllowMultiple = false)]
- internal sealed class RequiredMemberAttribute : Attribute
- {
- public RequiredMemberAttribute()
- {
- }
- }
-
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
- internal sealed class CompilerFeatureRequiredAttribute : Attribute
- {
- public CompilerFeatureRequiredAttribute(string featureName)
- {
- FeatureName = featureName;
- }
- public string FeatureName { get; }
- public bool IsOptional { get; set; }
- }
-}
-
-namespace System.Diagnostics.CodeAnalysis
-{
- [AttributeUsage(AttributeTargets.Constructor, Inherited = false, AllowMultiple = false)]
- internal sealed class SetsRequiredMembersAttribute : Attribute
- {
- public SetsRequiredMembersAttribute()
- {
- }
- }
-}
-#endif