Open
Description
Summary
This property only has two documented values, "Windows_NT" and "Unix", but this doesn't tell the story accurately today. In addition, this property like all properties can be overridden by environment variables. We should guide users to better-supported mechanisms for determining the OS of the executing build. Users should use the static members of the System.OperatingSystem
like IsWindows()
to check platform support.
Background and Motivation
We don't have documented guidance for moving away from $(OS)
, this should help drive that as well.
Sample issue or antipattern that the check should be flagging
This
<DotNetHostFileName>dotnet</DotNetHostFileName>
<DotNetHostFileName Condition="'$(OS)' == 'Windows_NT'">dotnet.exe</DotNetHostFileName>
should suggest using
<DotNetHostFileName>dotnet</DotNetHostFileName>
<DotNetHostFileName Condition="$([System.OperatingSystem]::IsWindows())">dotnet.exe</DotNetHostFileName>
instead
Sample output
No response