Fix .NET init: non-fatal WinApp package NuGet lookup, gate MSIX mutations on actual package add#416
Merged
zateutsch merged 5 commits intozt/395-csproj-version-overwritingfrom Apr 8, 2026
Conversation
…roperty gating, and new tests Agent-Logs-Url: https://github.com/microsoft/winappCli/sessions/50e26f8b-ae4e-4422-919e-041ac5cc71b8 Co-authored-by: zateutsch <88554871+zateutsch@users.noreply.github.com>
…st enumeration Agent-Logs-Url: https://github.com/microsoft/winappCli/sessions/50e26f8b-ae4e-4422-919e-041ac5cc71b8 Co-authored-by: zateutsch <88554871+zateutsch@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix CI failures in microsoft/winappCli due to NuGet version issues
Fix .NET init: non-fatal WinApp package NuGet lookup, gate MSIX mutations on actual package add
Apr 8, 2026
Contributor
|
@copilot can you target this PR against "zt/395-csproj-version-overwriting" instead |
…p prompt, non-fatal NuGet, winAppPackageApplied gate Agent-Logs-Url: https://github.com/microsoft/winappCli/sessions/b9e296f0-f8bb-4998-b153-0d5e3bf2ec05 Co-authored-by: zateutsch <88554871+zateutsch@users.noreply.github.com>
Contributor
Author
Done in commit Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
…failures-winappcli
zateutsch
approved these changes
Apr 8, 2026
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.
winapp initwas returning exit code 1 whenever NuGet version resolution failed forMicrosoft.Windows.SDK.BuildTools.WinApp, and MSIX csproj properties were being mutated regardless of whether the WinApp integration package was actually added.Behavior changes
WorkspaceSetupService.cs--use-defaultsor when the package is already referenced; otherwise prompts the user.Microsoft.Windows.SDK.BuildTools.WinAppis nowrequired: falsein the package list — a transient failure warns and continues rather than aborting init.winAppPackageAppliedtracking:EnsureEnableMsixToolingAsyncandRemoveWindowsPackageTypeNoneAsyncare only called when the WinApp package was successfully added/updated, not merely when the user opted in.IDotNetService/DotNetServiceNew methods:
EnsureEnableMsixToolingAsync,RemoveWindowsPackageTypeNoneAsync,AnnotatePackageReferencesAsync. Uses a separateRuntimeIdentifierSimpleElementRegexto avoid breaking the existingEnsureRuntimeIdentifierAsyncwhich needs to match<RuntimeIdentifier Condition="...">forms.Tests added (
WorkspaceSetupServiceTests.cs)SetupWorkspace_DotNet_InitSucceeds_WhenNuGetThrowsForWinAppPackage— exit code 0 when NuGet throws for the WinApp packageSetupWorkspace_DotNet_DoesNotApplyMsixProperties_WhenWinAppNotOptedIn—EnableMsixToolingnot written when user declinesSetupWorkspace_DotNet_PreservesExistingPackageVersions— pinned versions are keptSetupWorkspace_DotNet_SkipsWinAppPrompt_WhenPackageAlreadyReferenced— no prompt when already referencedFakeNugetServicegains aPackagesToThrowset to simulate per-package NuGet failures.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/microsoft/msstore-cli/releases/latest/home/REDACTED/work/winappCli/winappCli/src/winapp-CLI/WinApp.Cli.Tests/bin/Debug/net10.0-windows10.0.19041.0/WinApp.Cli.Tests /home/REDACTED/work/winappCli/winappCli/src/winapp-CLI/WinApp.Cli.Tests/bin/Debug/net10.0-windows10.0.19041.0/WinApp.Cli.Tests --server dotnettestcli --dotnet-test-pipe /tmp/37e5f171e9414b228cb09a28c14f5b71(http block)/home/REDACTED/work/winappCli/winappCli/src/winapp-CLI/WinApp.Cli.Tests/bin/Debug/net10.0-windows10.0.19041.0/WinApp.Cli.Tests /home/REDACTED/work/winappCli/winappCli/src/winapp-CLI/WinApp.Cli.Tests/bin/Debug/net10.0-windows10.0.19041.0/WinApp.Cli.Tests --server dotnettestcli --dotnet-test-pipe /tmp/a9c118b0f7af4ef4ba6f988be7fce656(http block)/home/REDACTED/work/winappCli/winappCli/src/winapp-CLI/WinApp.Cli.Tests/bin/Debug/net10.0-windows10.0.19041.0/WinApp.Cli.Tests /home/REDACTED/work/winappCli/winappCli/src/winapp-CLI/WinApp.Cli.Tests/bin/Debug/net10.0-windows10.0.19041.0/WinApp.Cli.Tests --server dotnettestcli --dotnet-test-pipe /tmp/65ed7e97e0c043a2a6487a99a65f17ca(http block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Fix PR #407 CI failures in microsoft/winappCli (run 24152826595, job 70484215857).
Failing tests indicate
winapp initreturns exit code 1 when NuGet version resolution fails forMicrosoft.Windows.SDK.BuildTools.WinApp(akaDotNetService.WINDOWS_SDK_BUILD_TOOLS_WINAPP_PACKAGE). Logs show:[ERROR] - Failed to get version for Microsoft.Windows.SDK.BuildTools.WinAppand asserts expect init to succeed.Implement two behavior changes in the .NET init path:
Do not hard-fail init when NuGet version lookup fails for
Microsoft.Windows.SDK.BuildTools.WinApp. It should be treated as non-fatal (warn and continue), while still keeping core build tools package required.Do not mutate MSIX csproj properties (e.g.,
EnableMsixTooling, removal ofWindowsPackageType=None) unless the WinApp integration package is actually present/added successfully. If the user declines the WinApp package, or if adding/updating it failed, do not apply MSIX property mutations.Target file:
src/winapp-CLI/WinApp.Cli/Services/WorkspaceSetupService.csUpdate logic around the dynamic package list and the
Adding NuGet packages to projectsubtask to:Add/adjust tests as needed (likely in
src/winapp-CLI/WinApp.Cli.Tests/WorkspaceSetupServiceTests.cs) to cover:Microsoft.Windows.SDK.BuildTools.WinApp.Please open a PR with the changes.
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.
Assistant: The job is failing because
winapp initreturns exit code 1 during the .NET init flow when it tries to resolve NuGet versions, specifically:[ERROR] - Failed to get version for Microsoft.Windows.SDK.BuildTools.WinAppWorkspaceSetupServicewhere that package is treated as required; if version lookup fails, init fails.There’s also a separate test failure where MSIX tooling properties are being applied even when the WinApp integration package is declined.
Fix 1 (primary): Don’t fail init when NuGet version lookup fails for the WinApp integration package
In
WorkspaceSetupService.cs, the .NET path builds a dynamic package list and marks the WinApp integration package asRequiredwheninstallWinAppPackage == true:Then, inside the “Adding NuGet packages to project” subtask, any failure to fetch the latest version for a required package returns
(1, ...)and aborts init:Recommended change
Treat
Microsoft.Windows.SDK.BuildTools.WinAppas non-fatal when version resolution fails, and fall back to:Concrete code suggestion (minimal behavioral change: keep trying, but don’t fail init just because NuGet version lookup failed for this package):
In
src/winapp-CLI/WinApp.Cli/Services/WorkspaceSetupService.cs(ref66ee83b12c8470adc1c0fd34a13b1375e9552608), change the “required” flag for the WinApp package tofalse:if (installWinAppPackage) { - packages.Add((DotNetService.WINDOWS_SDK_BUILD_TOOLS_WINAPP_PACKAGE, true)); + // Don't fail init if NuGet metadata is temporarily unavailable for this integration package. + packages.Add((DotNetService.WINDOWS_SDK_BUILD_TOOLS_WINAPP_PACKAGE, false)); }And keep
BuildToolsService.BUILD_TOOLS_PACKAGEas required.This directly addresses the failing tests/logs: init should succeed even if that package version can’t be fetched at that moment.
Fix 2: Only apply MSIX properties if the WinApp integration package was actually added/updated
One test is failing:
SetupWorkspace_DotNet_DoesNotApplyMsixProperties_WhenWinAppNotOptedInEnableMsixToolingshould not be added when user declines the WinApp packageEnableMsixToolinganyway.In
WorkspaceSetupService.cs, MSIX properties are applied based oninstallWinAppPackage: