How to specify the equivalent of /features:strict (of csc.exe) to msbuild.exe or in the .csproj file?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 17:51:49

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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!