Consider this simple (and bad) C# class:
using System;
namespace N
{
static class C
{
static void M(DateTime d)
{
if
This flag is supported in csproj file directly, just add:
<Features>strict</Features>
To the appropriate PropertyGroup in your csproj file, and after build you will see this warning for your code:
Warning CS8073 The result of the expression is always 'false' since a value of type 'DateTime' is never equal to 'null' of type 'DateTime?'
If you want to do the same via msbuild command-line interface, just set this property with /p:Features=strict
, like this:
/t:rebuild /p:Configuration=Debug /p:Platform=x64 /p:Features=strict