diff --git a/src/Avalonia.Base/Avalonia.Base.csproj b/src/Avalonia.Base/Avalonia.Base.csproj
index 1dbfe9fd8e..4ffd9de1b6 100644
--- a/src/Avalonia.Base/Avalonia.Base.csproj
+++ b/src/Avalonia.Base/Avalonia.Base.csproj
@@ -32,6 +32,7 @@
+
diff --git a/src/Avalonia.Base/Compatibility/StringSyntaxAttribute.cs b/src/Avalonia.Base/Compatibility/StringSyntaxAttribute.cs
new file mode 100644
index 0000000000..2b3585fbe4
--- /dev/null
+++ b/src/Avalonia.Base/Compatibility/StringSyntaxAttribute.cs
@@ -0,0 +1,43 @@
+#pragma warning disable MA0048 // File name must match type name
+// https://github.com/dotnet/runtime/blob/v8.0.4/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/StringSyntaxAttribute.cs
+
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+// ReSharper disable once CheckNamespace
+namespace System.Diagnostics.CodeAnalysis
+{
+#if !NET7_0_OR_GREATER
+ /// Specifies the syntax used in a string.
+ [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
+ internal sealed class StringSyntaxAttribute : Attribute
+ {
+ /// Initializes the with the identifier of the syntax used.
+ /// The syntax identifier.
+ public StringSyntaxAttribute(string syntax)
+ {
+ Syntax = syntax;
+ Arguments = Array.Empty