0

I have developed a UWP class library , and it is already used in various projects.

Now I want to make this UWP class library to support WindowsAppSdk apps too.

When I try to refer UWP Library in WindowsAppSdk app, getting error like "Project is not compatible".

My UWP class library min supported version - Windows 10 fall creators update (16299).

Should I recreate my UWP Library as WindowsAppSdk library ?

Can anyone help me understand this

Thanks Noorul.

Noorul
  • 873
  • 2
  • 9
  • 26
  • Perhaps you can try [multi-targetting](https://github.com/MintPlayer/MintPlayer.MVVM/blob/master/Library/MintPlayer.MVVM/MintPlayer.MVVM.csproj), but the different versions have to be compatible with each other.... – Pieterjan Sep 01 '22 at 05:53

1 Answers1

0

Should I recreate my UWP Library as WindowsAppSdk library ?

No, but you should convert it into a .NET Standard library that can be consumed by both UWP and WinUI (.NET) applications, and any other type of application whose runtime implementation supports the version of the .NET Standard specification that you choose to target.

UWP apps cannot consume librararies that are targeted against a specific platform such as .NET and vice versa. That's where .NET Standard comes in. It enables you to share code across multiple .NET implementations and platforms.

mm8
  • 163,881
  • 10
  • 57
  • 88
  • I have common shared code in .net standard library, this UWP and WinUI libraries needed to access specific features like Storage , Device details etc... – Noorul Sep 06 '22 at 09:18
  • 1
    These "specific features" are specific to a certain UI technology and cannot really be shared across UWP and WinUI. So then you need two separate libraries or a include a bunch of conditional compilation directives in your "shared" code base. – mm8 Sep 06 '22 at 13:04