Related to #45851
Recently we added new analyzer which checks platform name/version correctness for SupportedOSPlatform and UnsupportedOSPlatform attributes usage, testing the analyzer with runtime repo produced warnings for generated files XYZ.AssemblyInfo.cs, see logs below
D:\dotnet\runtime\artifacts\obj\Microsoft.Win32.Primitives\net6.0-Unix-Debug\Microsoft.Win32.Primitives.AssemblyInfo.cs(33,12): error CA1418: The platform 'Unix' is not a known platform name [D:\dotnet\runtime\src\libraries\Microsoft.Win32.Primitives\src\Microsoft.Win32.Primitives.csproj]
D:\dotnet\runtime\artifacts\obj\Microsoft.Win32.Primitives\net6.0-Browser-Debug\Microsoft.Win32.Primitives.AssemblyInfo.cs(33,12): error CA1418: Version '1.0' is not valid for platform 'Browser'. Do not use versions for this platform. [D:\dotnet\runtime\src\libraries\Microsoft.Win32.Primitives\src\Microsoft.Win32.Primitives.csproj]
D:\dotnet\runtime\artifacts\obj\System.IO.FileSystem.Watcher\net6.0-Linux-Debug\System.IO.FileSystem.Watcher.AssemblyInfo.cs(35,12): error CA1418: Version '1.0' is not valid for platform 'Linux'. Do not use versions for this platform. [D:\dotnet\runtime\src\libraries\System.IO.FileSystem.Watcher\src\System.IO.FileSystem.Watcher.csproj]
D:\dotnet\runtime\artifacts\obj\System.IO.FileSystem.Watcher\net6.0-OSX-Debug\System.IO.FileSystem.Watcher.AssemblyInfo.cs(35,12): error CA1418: The platform 'OSX' is not a known platform name [D:\dotnet\runtime\src\libraries\System.IO.FileSystem.Watcher\src\System.IO.FileSystem.Watcher.csproj]
D:\dotnet\runtime\artifacts\obj\System.Net.NetworkInformation\net6.0-illumos-Debug\System.Net.NetworkInformation.AssemblyInfo.cs(35,12): error CA1418: The platform 'illumos' is not a known platform name [D:\dotnet\runtime\src\libraries\System.Net.NetworkInformation\src\System.Net.NetworkInformation.csproj]
D:\dotnet\runtime\artifacts\obj\System.IO.Ports\netstandard2.0-windows-Debug\System.IO.Ports.AssemblyInfo.cs(13,12): error CA1418: The platform 'browser' is not a known platform name [D:\dotnet\runtime\src\libraries\System.IO.Ports\src\System.IO.Ports.csproj]
It is basically because the SDK adding the attribute for the target platform into XYZ.AssemblyInfo.cs file, and that platform is not exist in the MSBuild supported platforms list or not expected to have a version part.
I can fix it easily by updating the analyzer to not analyze a generated files, but not sure if we want to do any other way of fix instead as i assume it is only runtime specific issue
CC @jeffhandley @terrajobst @safern @ViktorHofer @Anipik
Related to #45851
Recently we added new analyzer which checks platform name/version correctness for
SupportedOSPlatform and UnsupportedOSPlatformattributes usage, testing the analyzer with runtime repo produced warnings for generated filesXYZ.AssemblyInfo.cs, see logs belowIt is basically because the SDK adding the attribute for the target platform into
XYZ.AssemblyInfo.csfile, and that platform is not exist in the MSBuild supported platforms list or not expected to have a version part.I can fix it easily by updating the analyzer to not analyze a generated files, but not sure if we want to do any other way of fix instead as i assume it is only runtime specific issue
CC @jeffhandley @terrajobst @safern @ViktorHofer @Anipik