Use MSBuild version comparison functions instead of numerical comparisons#2843
Merged
Use MSBuild version comparison functions instead of numerical comparisons#2843
Conversation
…sons
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>
Contributor
|
Claude finished @thomhurst's task —— View job Code Review: MSBuild Version Comparison Changes ✅Todo List:
Changes SummaryFile: Before: <DefineConstants Condition="$(RoslynVersion) >= 4.7">$(DefineConstants);ROSLYN4_7_OR_GREATER</DefineConstants>
<DefineConstants Condition="$(RoslynVersion) >= 4.14">$(DefineConstants);ROSLYN4_14_OR_GREATER</DefineConstants>After: <DefineConstants Condition="$([MSBuild]::VersionGreaterThanOrEquals('$(RoslynVersion)', '4.7'))">$(DefineConstants);ROSLYN4_7_OR_GREATER</DefineConstants>
<DefineConstants Condition="$([MSBuild]::VersionGreaterThanOrEquals('$(RoslynVersion)', '4.14'))">$(DefineConstants);ROSLYN4_14_OR_GREATER</DefineConstants>Review Feedback✅ Code Quality & Best PracticesThis is an excellent improvement! The change replaces string-based numerical comparison with proper semantic version comparison:
✅ Bug FixesThis change fixes a significant bug: Problem with old approach:
Solution:
✅ Performance Considerations
✅ Security Concerns
✅ Test Coverage
RecommendationLGTM 🎉 This is a high-quality bug fix that:
The change is small, focused, and addresses a specific technical debt issue. Perfect example of defensive programming! Minor Suggestions
|
|
I can confirm that everything works in 0.55.0. Thanks for the fixes! |
This was referenced Aug 12, 2025
This was referenced Sep 29, 2025
This was referenced Oct 6, 2025
This was referenced Oct 14, 2025
This was referenced Oct 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@Brokolis fingers crossed!