Skip to content

fix(maui): keep Microsoft.Maui.Controls out of the package dependencies - #135

Merged
framinosona merged 1 commit into
mainfrom
framinosona/pack-maui-controls-private
Nov 24, 2026
Merged

framinosona merged 1 commit into
mainfrom
framinosona/pack-maui-controls-private

Conversation

@framinosona

@framinosona framinosona commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Summary

Marks the two Microsoft.Maui.Controls references (Bluetooth.Maui and Bluetooth.Maui.Platforms.DotNetCore) as PrivateAssets="all". Refs #133.

Why

#108 added an explicit Microsoft.Maui.Controls reference (10.0.130). An explicit reference replaces the SDK's implicit one, which is private for libraries, so since 4.0.37 the package declares Microsoft.Maui.Controls (>= 10.0.130). A project that gets Controls only from its workload (10.0.110 with workload set 10.0.404) then fails restore with NU1605.

Change Type

  • Bug fix
  • Feature
  • Refactor (refa)
  • Docs only
  • CI/build/tooling

Affected Areas

  • Facade (Bluetooth.Maui)
  • Platform: DotNetCore fallback

Behavior And Compatibility

  • Public API changed
  • No externally visible behavior change

The package dependency list goes back to what 4.0.36 had. Plugin.ExceptionListeners.Maui still brings Controls transitively, as before.

Platform Notes

Does not fix the .pri files that 4.0.37 and later ship, which cause APPX0002 on a Windows target built from a non-Windows host. That part of #133 stays open.

Tests

  • dotnet pack Bluetooth.Maui -p:TargetFrameworks=net10.0 before and after: the nuspec lists Microsoft.Maui.Controls 10.0.130 before and no longer lists it after; every other dependency is unchanged.
  • The package this PR's CI built (Bluetooth.Maui.4.0.39-framinosona-pack-maui-controls-private.393): none of the five dependency groups (net10.0, Android, iOS, Mac Catalyst, Windows) lists Microsoft.Maui.Controls; each still lists Plugin.ExceptionListeners.Maui 1.0.11. The two .pri files are still in the Windows folder, as the summary says.

The explicit Microsoft.Maui.Controls reference that #108 added replaces the SDK's implicit one, which is private for libraries, so since 4.0.37 the package declares Controls 10.0.130. A consumer whose workload provides an older Controls then fails restore with NU1605. Marking both references private restores the 4.0.36 dependency list.
Copilot AI balanced review requested due to automatic review settings November 24, 2026 13:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain for the scoped dependency-packaging changes.

No open issues 🎉

What changed in this PR

This PR adjusts dependency packaging for the MAUI facade and DotNetCore fallback, addressing the Microsoft.Maui.Controls downgrade error reported in #133. The separate Windows .pri packaging issue remains out of scope.

Changes:

  • Adds PrivateAssets="all" to both explicit Controls references, keeping them available for compilation but excluding them as direct package dependencies.
  • Retains the existing 10.0.130 version override without changing public APIs or Bluetooth runtime logic.
File Description
Bluetooth.Maui/​Bluetooth.Maui.csproj Makes the facade’s Controls reference private.
Bluetooth.Maui.Platforms.DotNetCore/​Bluetooth.Maui.Platforms.DotNetCore.csproj Applies the same dependency isolation to the DotNetCore fallback.

Review effort: Balanced

@framinosona
framinosona merged commit 3151ad0 into main Nov 24, 2026
10 checks passed
@framinosona
framinosona deleted the framinosona/pack-maui-controls-private branch November 24, 2026 13:35
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.

2 participants