Skip to content

Fix MAUI testing with SDK versions earlier than global.json #4865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link

@Copilot Copilot AI commented May 27, 2025

Problem

When trying to run MAUI performance tests against an SDK version that is earlier than the one specified in global.json, the installation fails. This happens because:

  1. MAUI tests get SDK versions from a remote JSON file (e.g., https://maui.blob.core.windows.net/metadata/sdks/net9.0.json)
  2. If this version is earlier than what's in global.json, it gets ignored due to DOTNET_MULTILEVEL_LOOKUP=0 setting
  3. This causes failures in the build pipeline when trying to extract base path information

Solution

This PR implements a temporary removal of global.json when installing the MAUI SDK if the version is earlier than the one specified in global.json. This allows the earlier SDK version to be installed without being ignored by the .NET SDK's version resolution logic.

Key aspects of the implementation:

  1. Uses semantic versioning for accurate comparison of SDK versions
  2. Temporarily moves global.json out of the way when needed
  3. Includes robust error handling to ensure global.json is always restored
  4. Maintains proper backup mechanisms to prevent data loss

The changes are isolated to the MAUI installation code and won't affect other parts of the codebase.

Fixes #4355.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] Unable to run performance tests against SDK version that is earlier than in global.json Fix MAUI testing with SDK versions earlier than global.json May 27, 2025
@Copilot Copilot AI requested a review from LoopedBard3 May 27, 2025 05:51
Copilot finished work on behalf of LoopedBard3 May 27, 2025 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to run performance tests against SDK version that is earlier than in global.json
2 participants