Environment: vs 2022 v 17.4.0, with NET7 sdk installed
I have a multi target project net7.0;net472:
<PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFrameworks>net7.0;net472</TargetFrameworks>      
        <LangVersion>11.0</LangVersion>
        <!--others-->
    </PropertyGroup>
I tried to use the new feature required in c# 11 as given below:
public class Person
    {
        public required int Id { get; set; }
       
    }
I get a compilation error in net472:
Error CS0656 Missing compiler required member 'System.Runtime.CompilerServices.CompilerFeatureRequiredAttribute..ctor'
Error CS0656 Missing compiler required member 'System.Runtime.CompilerServices.RequiredMemberAttribute..ctor'
My workaround solution is using conditional compilation as:
 public class Person
    {
       
        public
#if NET7_0
            required
#endif
            int Id { get; set; }
    }
What should I do to support the new features 'required' of c# 11 in a multi target project has net47x?
 
     
    