How to enable Nullable Reference Types feature of C# 8.0 for the whole project

前端 未结 6 1817
庸人自扰
庸人自扰 2020-12-05 03:44

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

6条回答
  •  感动是毒
    2020-12-05 04:19

    For Visual Studio 2019 Preview 2 & 3, see Ian Griffiths's answer.

    Solution for Visual Studio 2019 Preview 1:

    To enable Nullable Reference Types feature for the .NET Core project, add NullableReferenceTypes property to the .csproj file like this:

    
      ...
      true
      8.0
    
    

    As @JulienCouvreur referenced in comments regarding to https://github.com/dotnet/project-system/issues/4058, the new property is not yet supported in 'old' project system, but will be supported before C# 8.0 released.

提交回复
热议问题