2024 Updated answer
You can increase the severity of the CA1069
analyzer to make the compiler report it as error and prevent compilation.
dotnet_diagnostic.CA1069.severity = error
see more https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1069