Skip to content

Recognize Uno WinUI without selecting UWP XAML - #70

Open
Sergio0694 wants to merge 4 commits into
DotNetPlus:mainfrom
Sergio0694:user/sergiopedri/uno-winui-support
Open

Sergio0694 wants to merge 4 commits into
DotNetPlus:mainfrom
Sergio0694:user/sergiopedri/uno-winui-support

Conversation

@Sergio0694

@Sergio0694 Sergio0694 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #33.

Summary

  • Detect Uno WinUI from the defining assembly of Microsoft.UI.Xaml.DependencyObject: Uno.UI for existing versions or Uno.WinUI for Uno 7.0 and later. Detection remains independent of reference display paths and class/interface shape; missing, ambiguous, and unrelated types do not select Uno.
  • Generate Microsoft.UI.Xaml markup-extension and converter helpers with the Windows resource loader and optional Windows.Globalization.ApplicationLanguages resolver, without requiring UseUwp=true or UWP XAML compatibility shims.
  • Add the opt-in ReswPlusAppType property to override automatic detection. Auto remains the default; explicit WindowsAppSDK, UWP, or UnoWinUI overrides both detected references and the legacy UseUwp fallback. Invalid values report RESWP0021 and stop generation rather than silently falling back.
  • Preserve automatic WinAppSDK/UWP behavior and incremental caching, add end-to-end generator and real MSBuild integration coverage, and document per-target configuration and consumer cleanup without manually wrapping prose.

Separate follow-up commits

  • abe8863: recognize the Uno 7 Uno.WinUI assembly, with expanded detection and cache-transition coverage.
  • e9ced7b: add the opt-in application-model override, diagnostics, packaging integration, documentation, and tests.

Configuration

For an Uno application, an override can be restricted to non-Windows target frameworks so that a Windows App SDK head keeps automatic detection:

<PropertyGroup Condition="'$(TargetFramework)' != '' and $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'windows'">
    <ReswPlusAppType>UnoWinUI</ReswPlusAppType>
</PropertyGroup>

Supported names are case-insensitive and ignore surrounding whitespace. Unset, empty, or Auto preserves detection and the existing UseUwp fallback. The override selects the generated APIs; it does not add platform references.

Validation

  • All 1,551 tests pass, including 47 Uno detection cases, 77 override cases, and 12 real MSBuild property/default/export and README-condition evaluations.
  • Synthesized Roslyn references cover both Uno defining assemblies under unrelated display paths, class/interface shapes, negative and ambiguous matches, and the Uno 6-to-7 assembly transition without unnecessary regeneration. Uno 7 coverage uses synthesized metadata, not an actual Uno 7 package.
  • Override tests cover all app models, unknown and misleading references, precedence over conclusive detection and UseUwp, strict invalid-value handling, culture-independent parsing, interfaces and application-language options, normalized equality/hash behavior, option-only cache invalidation, and removal/restoration of generated sources.
  • A real SDK compilation verifies the packaged property reaches generated analyzer configuration and enables ordinary, formatted, plural, injectable-resource, markup-extension, and converter helpers against an otherwise undetectable compatible projection. It compiles with warnings treated as errors; switching to Auto reports the expected RESWP0005.
  • The updated generator also compiles those helpers against Uno.WinUI 6.7.135's actual net10.0-android assemblies with automatic detection, application-language resolution, and warnings treated as errors, without UseUwp=true or compatibility shims.
  • Opus 5.5 with 1M long context and High reasoning acted as design rubber duck and final reviewer, finding no remaining substantive issues.

Android validation is compile-only, not UI/runtime testing. Acceptance probes intentionally suppress the existing markup-extension deprecation warning while checking its type bindings.

Existing limitation

The unchanged macro helpers can produce Uno0001 warnings for Windows APIs Uno does not implement. This limitation is documented in the FAQ; these diagnostics are not suppressed by this change.

Sergio0694 and others added 2 commits October 13, 2026 18:22
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@Sergio0694
Sergio0694 marked this pull request as ready for review October 14, 2026 01:31
Sergio0694 and others added 2 commits October 14, 2026 10:50
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Support for Uno platform (WinUI3)

2 participants