Use 'required' members when targeting net6.0;net7.0 #6797
-
I'd like to use required members for a project that targets both The .NET 6 build gives build errors for missing attributes that were introduced in .NET 7 to support required members:
Can I add some package that defines these attributes, or define them myself to make the build work? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Officially, C# 11 is only supported on .NET 7.0 and newer. Microsoft doesn't provide assemblies to polyfill older runtimes. See: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/configure-language-version You can provide your own, though, and there may be third-party NuGet packages out there to do the same. |
Beta Was this translation helpful? Give feedback.
-
Sure you can! Just add PolySharp and enable C# 11 😄
|
Beta Was this translation helpful? Give feedback.
-
I actually found myself in a similar situation... I really didn't care about net6.0, but wanted the net7.0 build to leverage |
Beta Was this translation helpful? Give feedback.
Sure you can! Just add PolySharp and enable C# 11 😄