Skip to content

Commit f4a0cfb

Browse files
thomhurstclaude
andauthored
Use MSBuild version comparison functions instead of numerical comparisons (#2843)
Replace direct numerical comparisons with MSBuild's built-in version comparison functions for better reliability and correctness. Changes: - Updated Directory.Build.targets to use MSBuild::VersionGreaterThanOrEquals for RoslynVersion comparisons - Changed $(RoslynVersion) >= 4.7 to $([MSBuild]::VersionGreaterThanOrEquals('$(RoslynVersion)', '4.7')) - Changed $(RoslynVersion) >= 4.14 to $([MSBuild]::VersionGreaterThanOrEquals('$(RoslynVersion)', '4.14')) Benefits: - Correct semantic version comparison (handles "4.10" > "4.9" properly) - Better compatibility across different MSBuild versions - Type-safe version comparisons 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude <noreply@anthropic.com>
1 parent ccea198 commit f4a0cfb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Directory.Build.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<DefineConstants Condition="$(RoslynVersion) >= 4.7">$(DefineConstants);ROSLYN4_7_OR_GREATER</DefineConstants>
4-
<DefineConstants Condition="$(RoslynVersion) >= 4.14">$(DefineConstants);ROSLYN4_14_OR_GREATER</DefineConstants>
3+
<DefineConstants Condition="$([MSBuild]::VersionGreaterThanOrEquals('$(RoslynVersion)', '4.7'))">$(DefineConstants);ROSLYN4_7_OR_GREATER</DefineConstants>
4+
<DefineConstants Condition="$([MSBuild]::VersionGreaterThanOrEquals('$(RoslynVersion)', '4.14'))">$(DefineConstants);ROSLYN4_14_OR_GREATER</DefineConstants>
55
</PropertyGroup>
66
</Project>

0 commit comments

Comments
 (0)