Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 15, 2026

install_latest_maui() queries package feeds via dotnet package search, which requires access to MAUI-specific NuGet sources. The function was called before entering MauiNuGetConfigContext, causing package resolution failures when dependencies exist only in MAUI feeds.

Changes

Moved install_latest_maui(precommands) inside the MauiNuGetConfigContext block for all MAUI scenarios:

  • mauiandroid/pre.py
  • mauiios/pre.py
  • mauiblazorandroid/pre.py
  • mauiblazorios/pre.py
  • mauisamplecontentandroid/pre.py
  • mauidesktop/pre.py
  • mauiblazordesktop/pre.py

This ensures the merged NuGet.config (containing MAUI package sources) is active during workload installation, not just during dotnet new and dotnet build.

# Before
precommands = PreCommands()
install_latest_maui(precommands)  # Missing MAUI sources
with MauiNuGetConfigContext(precommands.framework):
    precommands.new(template='maui', ...)

# After
precommands = PreCommands()
with MauiNuGetConfigContext(precommands.framework):
    install_latest_maui(precommands)  # Has MAUI sources
    precommands.new(template='maui', ...)
Original prompt

For the mauiandroid and mauiios scenarios (and any other maui mobile scenarios that use the MauiNuGetConfigContext() and install_latest_maui_commands()) I think the install_latest_maui needs to be within the context of the MauiNuGetConfigContext as the current runs are failing because a specific version of the dependency that should be in the MauiNuGetConfigContext package providers is not being properly setup as not all of the package providers are yet in the NuGet.config for the repo. Please double check these assumptions and then fix the issue so that the install_latest_maui will also be able to use the merged nuget configs.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix install_latest_maui command context for MauiNuGetConfigContext Move install_latest_maui inside MauiNuGetConfigContext for package source resolution Jan 15, 2026
Copilot AI requested a review from LoopedBard3 January 15, 2026 23:47
… android/ios projects so they succeed in installing Maui as well.
@LoopedBard3
Copy link
Member

Working performance_script build: https://dev.azure.com/dnceng/internal/_build/results?buildId=2880973&view=results (some jobs are still failing due to devices being offline, but we are getting to the send to helix step). There also seems to be some one device startup failures, but those should be investigated in another PR.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes package resolution failures by ensuring install_latest_maui() has access to MAUI-specific NuGet package sources. The function queries package feeds via dotnet package search, which requires the merged NuGet.config containing MAUI sources.

Changes:

  • Moved install_latest_maui(precommands) call inside MauiNuGetConfigContext block for all MAUI and .NET mobile scenarios
  • Added MauiNuGetConfigContext wrapper to netios and netandroid scenarios
  • Updated comments to clarify that the context provides sources for dotnet package search, dotnet new, and dotnet build/publish

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/scenarios/netios/pre.py Added MauiNuGetConfigContext wrapper and moved install_latest_maui inside it
src/scenarios/netandroid/pre.py Added MauiNuGetConfigContext wrapper and moved install_latest_maui inside it
src/scenarios/mauisamplecontentandroid/pre.py Moved install_latest_maui inside existing MauiNuGetConfigContext
src/scenarios/mauiios/pre.py Moved install_latest_maui inside existing MauiNuGetConfigContext
src/scenarios/mauidesktop/pre.py Moved install_latest_maui inside existing MauiNuGetConfigContext
src/scenarios/mauiblazorios/pre.py Moved install_latest_maui inside existing MauiNuGetConfigContext
src/scenarios/mauiblazordesktop/pre.py Moved install_latest_maui inside existing MauiNuGetConfigContext
src/scenarios/mauiblazorandroid/pre.py Moved install_latest_maui inside existing MauiNuGetConfigContext
src/scenarios/mauiandroid/pre.py Moved install_latest_maui inside existing MauiNuGetConfigContext

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@DrewScoggins DrewScoggins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@LoopedBard3 LoopedBard3 merged commit 2825803 into main Jan 17, 2026
41 of 44 checks passed
@LoopedBard3 LoopedBard3 deleted the copilot/fix-install-latest-maui-issue branch January 17, 2026 21:30
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.

4 participants