File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -234,7 +234,20 @@ def install_latest_maui(
234
234
getLogger ().warning (f"Failed to read SDK version from global.json: { e } " )
235
235
236
236
# Compare versions to see if the MAUI SDK version is earlier
237
- if current_sdk_version and maui_sdk_version < current_sdk_version :
237
+ # We need to be careful with version comparison, especially with preview versions
238
+ is_earlier_version = False
239
+ try :
240
+ # First, try to parse the versions using packaging.version for proper semantic version comparison
241
+ from packaging import version
242
+ maui_ver = version .parse (maui_sdk_version )
243
+ current_ver = version .parse (current_sdk_version )
244
+ is_earlier_version = maui_ver < current_ver
245
+ except (ImportError , Exception ) as e :
246
+ # Fallback to simple string comparison if packaging module is not available
247
+ getLogger ().warning (f"Using simple string comparison for versions due to: { e } " )
248
+ is_earlier_version = maui_sdk_version < current_sdk_version
249
+
250
+ if current_sdk_version and is_earlier_version :
238
251
getLogger ().info (f"MAUI SDK version { maui_sdk_version } is earlier than global.json version { current_sdk_version } . Temporarily moving global.json." )
239
252
if os .path .exists (global_json_path ):
240
253
try :
You can’t perform that action at this time.
0 commit comments