According to the C# 8 announcement video the \"nullable reference types\" feature can be enabled for the whole project.
But how to enable it for the project? I did n
You asked about the legacy .csproj format. Open up the project file in a text editor and make the following changes:
Add/change in the Debug and Release PropertyGroup sections:
preview
Enable support for nullable reference types by adding to the main PropertyGroup:
enable
Tested with a .NET WinForms app using C# 8 and nullable reference types syntax in Visual Studio 2019 v16.2.0 Preview 3.
SDK style projects are much simpler, and can be edited within Visual Studio. For these all you need is (in the same PropertyGroup as TargetFramework or TargetFrameworks):
8.0
enable
.NET Core 3.x projects target C# 8 by default, so you won't need to specify the LangVersion for those projects.
The default for .NET Framework projects is C# 7.3, and you don't get C# 8.0 even with . You must explicitly set the language version to 8.0. Please refer to my answer to the question Does C# 8 support the .NET Framework? for more details.