Search code examples
c#uwpwinui-3multitargeting

Multitarget UWP usercontrol for WinUI and UWP


I would like to multitarget my UserControl for both UWP and WinUI.

I found this link: https://nicksnettravels.builttoroam.com/upgrade-uwp-to-winui/ but it is really hard to migrate all the features because my project is a bit bigger and also sorting and adding using directives for both WinUI and UWP is an annoying job. I really hope there is a better way.

Is there any simple way or a tool that could do this?


Solution

  • I'm not sure if there's a simple way to multi-target UWP and WinUI. But I'm sure that I wouldn't do so. These are the reasons that comes to mind.

    • UWP and WinUI use different namespaces.
    • Latest (and future) .NET doesn't support UWP, so your code will be stuck with old .NET.
    • Even the WindowsCommunityToolkit has two different solutions for UWP and WinUI, so I guess there's no simple way to multi-target UWP and WinUI.