How to disable null reference checking for a folder

Viewed 397

Here's the problem I'm trying to solve:

  • I have some *.proto files I'm generating using the <ProtoBuf MSBuild task from Grpc.Tools.
  • To the best of my knowledge, this neither supports generating nullable references code nor just putting #nullable disable at the top of the file.
  • But the project I want to include them in has Nullable enabled.

This will produce a bunch of classes where the compiler will treat the references as being non-nullable when they are, in fact, nullable. So I'm trying to come up with ways of dealing with this. Just to complicate things, this is a prototype that may be replicated across many projects, so I'm looking for as simple a solution as possible.

A separate project isn't particularly desirable, so I'm trying to find ways that I could mark the target directory as not being nullable enabled. So, is there a way to set the directive for a folder?

0 Answers
Related