Skip to content

Commit

Permalink
Fix LangVersion computation on non-English locales (#76070)
Browse files Browse the repository at this point in the history
* Fix LangVersion computation on non-English locales

* Add link to MSBuild issue
  • Loading branch information
jjonescz authored Nov 25, 2024
1 parent 7e34ee5 commit 079c507
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Compilers/Core/MSBuildTask/Microsoft.CSharp.Core.targets
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
- Pattern: .NET 5.0 uses C# 9.0, .NET 6.0 uses C# 10.0, and so on.
- Starting from C# 9.0 for .NET 5.0, we add the difference between the major .NET version and 5
to determine the correct language version.
NOTE: `.Split('.')[0]` needed due to https://github.com/dotnet/msbuild/issues/9757.
-->
<_MaxSupportedLangVersion Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' AND
'$(_MaxSupportedLangVersion)' == ''">$([MSBuild]::Add(9, $([MSBuild]::Subtract($(_TargetFrameworkVersionWithoutV), 5)))).0</_MaxSupportedLangVersion>
'$(_MaxSupportedLangVersion)' == ''">$([MSBuild]::Add(9, $([MSBuild]::Subtract($(_TargetFrameworkVersionWithoutV.Split('.')[0]), 5)))).0</_MaxSupportedLangVersion>

<!-- Cap _MaxSupportedLangVersion if it exceeds _MaxAvailableLangVersion -->
<_MaxAvailableLangVersion>13.0</_MaxAvailableLangVersion>
Expand Down

0 comments on commit 079c507

Please sign in to comment.