3

I'm trying to use Windows UI library in my WPF app, and whenever I install Microsoft.UI.Xaml I get the following error.

Microsoft.UI.Xaml nuget package requires TargetPlatformMinVersion >= 10.0.15063.0 (current project is -1)

How to resolve this issue?

My windows SDK version is the latest version downloaded from here.

My OS version is 20H2 and the build number is 19042.685

I tried changing the targeted framework from .NET Core 3, 3.1, and .NET 5.

[If you think the title of this question is not appropriate, feel free to suggest an edit.]

Mahmudul Hasan
  • 798
  • 11
  • 35
  • https://stackoverflow.com/questions/62128558/visual-studio-windows-ui-library-set-targetplatformminversion-and-targetplat – user2250152 Jan 06 '21 at 06:01
  • 1
    How followed the steps and noticed that there were no properties called `` or ``. So I added them manually and it didn't work. – Mahmudul Hasan Jan 06 '21 at 07:16
  • Can you post your reproducing project on the web somewhere? – Simon Mourier Jan 06 '21 at 08:13
  • You mean the full source code? – Mahmudul Hasan Jan 07 '21 at 07:16
  • I can install the `Microsoft.UI.Xaml` in my .Net core 3.1 WPF project with no error. If you upload the project to reproduce the error, it will help to analyze your problem more accurately. – DasiyTian_1203 Jan 08 '21 at 01:55
  • https://github.com/MahmudX/AwesomeWPF here is the full project – Mahmudul Hasan Jan 09 '21 at 04:58
  • Adding `10.0.18362.0` and `10.0.15063.0` to your csproj file will make your project run with no error. It refers to [Download and install the Windows UI Library](https://learn.microsoft.com/en-us/windows/apps/winui/winui2/getting-started#download-and-install-the-windows-ui-library). As fa as I know it is design for UWP not WPF, could you tell me what api or class do you want to use in WPF? – DasiyTian_1203 Jan 11 '21 at 08:24
  • The new Fluent design API. It looks awesome but the default WPF UI looks terrible. – Mahmudul Hasan Jan 12 '21 at 07:14
  • Did my suggestion work for your issue? If it is not, please let me what error did you meet. – DasiyTian_1203 Jan 13 '21 at 02:34
  • No, it didn't. I got the same error. IDK what went wrong. Sorry for my late reply. I went busy with my office project. – Mahmudul Hasan Feb 08 '21 at 05:16
  • I have the same problem. I'm using VS 2022. I think it's a bug. [Possible Failure of Target Platform detection](https://github.com/microsoft/microsoft-ui-xaml/issues/3596) – Toni Nov 03 '21 at 12:06

1 Answers1

0

I had the same problem transferring my project from .NET Framework 4.8 to .NET 6 (needed to have "using declarations").

Here's how I fixed mine:

  1. Go to the affected project's settings.
  2. Go to General and Target OS version.
  3. Choose 1.0.19041.0 (or at the very least it must be 10.0.18362.0)
  4. In the Supported OS version, choose any version except 7.0 or 8.0.
  5. Build the project.

I think (I'm not sure) the issue here is UI.Xaml doesn't support Win 7 or Win 8.

NoThrottle
  • 59
  • 1
  • 9