Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

This version of the MVVM Toolkit requires 'Microsoft.Windows.SDK.NET.Ref' version '10.0.19041.38' or later. | [ver. 8.3.1] #951

Closed
1 of 4 tasks
Auto72 opened this issue Sep 13, 2024 · 19 comments
Labels
by design Some behavior that is intended and not an issue mvvm-toolkit 🧰 Issues/PRs for the MVVM Toolkit

Comments

@Auto72
Copy link

Auto72 commented Sep 13, 2024

Describe the bug

Any .NET MAUI project using this library ver. 8.3.1, gets the following message when the library is added.

MVVMTKCFG0003

This version of the MVVM Toolkit requires 'Microsoft.Windows.SDK.NET.Ref' version '10.0.19041.38' or later. Please update to .NET SDK 8.0.109, 8.0.305 or 8.0.402 (or later).
Alternatively, use a temporary 'Microsoft.Windows.SDK.NET.Ref' reference, which can be done by setting the 'WindowsSdkPackageVersion' property in your .csproj file.
For your project configuration, it is recommended to set the package version to '10.0.19041.41'.

Regression

No response

Steps to reproduce

Create a .NET MAUI project and and the Library CommunityToolkit.Mvvm version 8.3.1.

Expected behavior

No error.
.NET SDK 8.0.402 is not out yet.
The package version to '10.0.19041.41' is not listed among the Windows Targets in the project.

Screenshots

No response

IDE and version

VS 2022

IDE version

No response

Nuget packages

  • CommunityToolkit.Common
  • CommunityToolkit.Diagnostics
  • CommunityToolkit.HighPerformance
  • CommunityToolkit.Mvvm (aka MVVM Toolkit)

Nuget package version(s)

8.3.1

Additional context

No response

Help us help you

No, just wanted to report this

@Auto72 Auto72 added the bug 🐛 An unexpected issue that highlights incorrect behavior label Sep 13, 2024
@Sergio0694
Copy link
Member

This is not a bug and it is quite literally by design, and that error message is telling you exactly what you need to do:

"Alternatively, use a temporary 'Microsoft.Windows.SDK.NET.Ref' reference, which can be done by setting the 'WindowsSdkPackageVersion' property in your .csproj file. For your project configuration, it is recommended to set the package version to '10.0.19041.41'."

That is, add this to your .csproj:

<WindowsSdkPackageVersion>10.0.19041.41</WindowsSdkPackageVersion>

@Sergio0694 Sergio0694 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 13, 2024
@Sergio0694 Sergio0694 added by design Some behavior that is intended and not an issue mvvm-toolkit 🧰 Issues/PRs for the MVVM Toolkit and removed bug 🐛 An unexpected issue that highlights incorrect behavior labels Sep 13, 2024
@michaelmairegger
Copy link

michaelmairegger commented Sep 13, 2024

@Sergio0694 The default sdk package version referenced, if not specified, is 10.0.19041.34. Are there some reasons why it is necessary to modify it and to point it at least to 10.0.19041.38? Why is the predefined .34 not enough?

@dongle-the-gadget
Copy link

In one word, AOT.

@Sergio0694
Copy link
Member

What dongle said is correct. The MVVM Toolkit 8.3 has been updated to support trimming and AOT in Windows apps (eg. WinUI 3, UWP, MAUI, etc.). in order to do this, it had to be recompiled against the new version of the Windows SDK projections, which include that support. If you tried to run an app using the MVVM Toolkit using an older version of that package, things would crash at runtime (because the old version isn't compatible). So instead I added a helpful error message to spot the issue early.

@michaelmairegger
Copy link

@Sergio0694 Ok, thank you very much for the clarification.

@MauiUIui
Copy link

@Sergio0694 So here is a thing I noticed:
When I got this error, I tried to do what you suggested, namely: it is recommended to set the package version to '10.0.19041.41'
Doing that yielded:

Severity	Code	Description	Project	File	Line	Suppression State	Details
Error (active)	NETSDK1140	10.0.19041.41 is not a valid TargetPlatformVersion for Windows. Valid versions include:
10.0.26100.0
10.0.22621.0
10.0.22000.0
10.0.20348.0
10.0.19041.0
10.0.18362.0
10.0.17763.0
.....

So I thought, what the hell, let's update to the latest version while at it. So I took 10.0.26100.0.
After recompiling, restoring packages and what not, I now get:
it is recommended to set the package version to '10.0.26100.41'. ProjectName (net8.0-windows10.0.26100.0)
Something is off with this help message.

@Sergio0694
Copy link
Member

You're not actually reading the message correctly. It's telling you to set the Windows SDK package version. You changed the target framework instead. That is absolutely not what the message said, and it's expected that doing so will break.

@ScottyLightnin
Copy link

ScottyLightnin commented Sep 19, 2024

This is not a bug and it is quite literally by design, and that error message is telling you exactly what you need to do:

It's not a bug that you've taken a dependency on a package that isn't released to production yet?
It might be by design, but I would argue that the design hasn't been very well thought through. Shouldn't you at least mark this nuget package as pre-release then?

@Sergio0694
Copy link
Member

Sergio0694 commented Sep 19, 2024

The package is released to production (eg. here it is).

@midnight-code
Copy link

Чего вы тут людям голову всякой фигнёй заливаете. Просто у тех у кого не работает ломанная винда стоит и она не обновлялась с версии 21H2. Пусть скачают 23H2 и будет им счастье.

@IronShell1207
Copy link

Чего вы тут людям голову всякой фигнёй заливаете. Просто у тех у кого не работает ломанная винда стоит и она не обновлялась с версии 21H2. Пусть скачают 23H2 и будет им счастье.

Стоит 23h2 лицензионная, та же проблема, но с winappsdk пакетом

@karmeye
Copy link

karmeye commented Sep 26, 2024

Downloaded 8.0.402 today, and running dotnet --version returns that version. But I still get this error if I remove <WindowsSdkPackageVersion>10.0.22621.38</WindowsSdkPackageVersion>.

@alex3696
Copy link

alex3696 commented Sep 26, 2024

The application crashes when displaying canvas SkiaSharp -
SkiaSharp 2.88.8 + MVVM Toolkit 8.3.2 + <WindowsSdkPackageVersion>10.0.26100.41</WindowsSdkPackageVersion>

@dongle-the-gadget
Copy link

SkiaSharp requires an update, not sure which version.

@alex3696
Copy link

alex3696 commented Sep 26, 2024

SkiaSharp requires an update, not sure which version.

I tried it with SkiaSharp versions 2.88.8, 3.0.0preview4.1 - the application crashes the same way, without having time to output
anything to the debugging console.

xmlns:skia="clr-namespace:SkiaSharp.Views.Maui.Controls;assembly=SkiaSharp.Views.Maui.Controls"
...
<skia:SKCanvasView PaintSurface="CanvasView_PaintSurface"/>

Is this a SkiaSharp or MVVM Toolkit problem?

@FrancescoCarraro
Copy link

This is not a bug and it is quite literally by design, and that error message is telling you exactly what you need to do:

It's not a bug that you've taken a dependency on a package that isn't released to production yet? It might be by design, but I would argue that the design hasn't been very well thought through. Shouldn't you at least mark this nuget package as pre-release then?

the error is a little bit confusing for me too. I also looked at the target os platform. I guess the new communitytoolkit version is based on new sdk versions. i found 10.0.26100.45 which seems to be ready for .net 9. Anyway, I temporarily moved back community toolkit to version 8.2.2 to get solution being compiled

@Sergio0694
Copy link
Member

Downloaded 8.0.402 today, and running dotnet --version returns that version. But I still get this error if I remove <WindowsSdkPackageVersion>10.0.22621.38</WindowsSdkPackageVersion>.

@karmeye that's expected. 8.0.402 doesn't include the fix. You'll need .403 which comes out next month.

I tried it with SkiaSharp versions 2.88.8, 3.0.0preview4.1 - the application crashes the same way, without having time to output anything to the debugging console.

xmlns:skia="clr-namespace:SkiaSharp.Views.Maui.Controls;assembly=SkiaSharp.Views.Maui.Controls"
...
<skia:SKCanvasView PaintSurface="CanvasView_PaintSurface"/>

Is this a SkiaSharp or MVVM Toolkit problem?

@alex3696 this issue is just about a build issue. For a runtime crash, please open another issue.

"i found 10.0.26100.45 which seems to be ready for .net 9"

@FrancescoCarraro .45 is for .NET 8 as well, but also you shouldn't reference it manually. Just follow the error message notes.

@karmeye
Copy link

karmeye commented Sep 27, 2024

@karmeye that's expected. 8.0.402 doesn't include the fix. You'll need .403 which comes out next month.

@Sergio0694 Aha, thank you. I was confused by the error message as it says: "Please update to .NET SDK 8.0.109, 8.0.305 or 8.0.402."

Would that be on patch Tuesday next month?

Is 403 the version that's referred to as the "next servicing update" in the note here?

Thx

@Sergio0694
Copy link
Member

Yeah the version in the message is wrong because things happened and the fix in the .NET SDK was delayed 🥲

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
by design Some behavior that is intended and not an issue mvvm-toolkit 🧰 Issues/PRs for the MVVM Toolkit
Projects
None yet
Development

No branches or pull requests