How to enable nullable reference types in VS 2022

I would like to turn on nullable reference types for a unity project (2022.1.9) in visual studio 2022. I’ve tried a directory.build.props file as well as a csc.rsp file with no luck. Putting -Nullable:enable in the compiler options worked, but only in unity, not in visual studio. Did the method for doing that change?

1 Like

Did you ever figure this one out? I can’t seem to either.

Looks like it may be related to the this issue with IntelliSense and old-style csproj files? (See discussion here: has no effect in old-style csproj)
TLDR: If I understand it right. IntelliSense tooling will not be updated to give framework 4.7.1 full support for C# 8. Microsoft says framework will only guarantee support for framework up to C# 7.3. Guess we’ll have to hold out for unity to support net 6 or something. VisualStudio won’t be back-fixing IntelliSense for nullable or other C# 8 features.