Use C# 9 records in non-net5.0 projects
PreviousPersisting output files from source generatorsNextAsyncLocal never leaks and is safe for CallContext-like state
Last updated
Last updated
The new C# 9 records syntax is quite nice:
When using it in a non-net5.0 project (i.e. netstandard2.0), :
To workaround the issue, simply declare the missing type in your project:
If you're multitargeting net5.0 and other TFMs, just add this bit of MSBuild to remove it for net5.0 since it's built-in:
(). Note the class doesn't even need to be public.