Closed DRAirey1 closed 1 month ago
Just read your error message, for now you should add this into your csproj file:
<WindowsSdkPackageVersion>10.0.19041.38</WindowsSdkPackageVersion>
Just read your error message, for now you should add this into your csproj file:
<WindowsSdkPackageVersion>10.0.19041.38</WindowsSdkPackageVersion>
It doesn't work when you target Windows 11 26100
This is definitely a bug. Nothing was wrong when I created a new winui3 project a week ago. But just now, I created a new project and encountered this problem. I even haven't updated anything!
Adding the line from ghost1372 seems to have fixed the problem as long as you go back and modify every WinUI package that you use to have the same settings. I have a WinUI package for common WinUI controls that was screwing up the build until I made the change there as well.
I think there must be something wrong with the latest WinUI3 default template, I have used Template Studio to create a new project and nothing was wrong.
Perhaps only bill gates knows how to "update to .NET SDK 6.0.134, 6.0.426, 8.0.109, 8.0.305 or 8.0.402 (or later)." Amazing
Just chiming in that I would really appreciate it if my students could start their experience with WinUI3 in a less buggy way. I kind of expect Visual Studio templates to be able to build and run out-of-the-box.
The solution posted and mentioned in the error works, but is not ideal at all.
Thanks for your efforts.
That seems to be caused by lower Target OS Version on Visual Studio WinUI Template:
Basically i set target OS Version to 10.0.19041.0
and it went away
I had this issue as well. These are the settings that worked for me with the template:
Package project:
Application project:
And add this to the application project's csproj:
However, I don't know WHY this works, and I find that a little concerning. There needs to be a table somewhere that lists out all the possible valid combinations of TargetFramework, TargetPlatformMinVersion, WindowsSdkPackageVersion, Microsoft.Windows.SDK.BuildTools, and Microsoft.WindowsAppSDK versions or an algorithm for determining how to update the others after you've updated one. Currently I have to guess and check until the build succeeds.
I tried all the suggested fixes but nothing worked.
Only thing that worked was to downgrade the WindowsAppSDK nuget.
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240627000" />
@DRAirey1 Thanks for reporting this issue. C#/WinRT is used to generate .NET projection assemblies for both Windows App SDK and the Windows SDK. On occasion, these must be updated together, but they are released independently. In such cases, WindowsSdkPackageVersion is necessary for a project to override the version of the Windows SDK projection implied by the TFM and the current .NET SDK. The message (which appears to be a raft of errors, but is only one) suggests the project edit needed. The OS version is derived from your TFM (i.e., 19041 is not hardcoded). E.g., a TargetFramework of net8.0-windows10.0.22000.0 will suggest adding a WindowsSdkPackageVersion of 10.0.22000.38. I realize this is a sharp edge - we'll look at defaulting the WindowsSdkPackageVersion as needed in a future release.
@Scottj1s Listen, for what it's worth, I'm old enough so that I've run into these issues a number of time. Things move forward, we all understand that. The big error, I think, that you made, was not updating the standard IDE template at the same time. If something goes FUBAR, the first thing I do is create a templated program to see how you guys are going it. That's my suggestion, for what it's worth, if you release a breaking change, make sure to update the IDE templates to show the right way to build the project. That'll save us all a lot of time.
WindowsSdkPackageVersion works in a new WinUI project, but it doesn't work at all if you want to use WinUI in a WPF project. It must be a shame to release a production version like this.
@DRAirey1 I hear you. Unfortunately, the templates have a completely separate ship vehicle and schedule (being distributed with Visual Studio). This means we have to be able to release changes to either, independent of the other. The decoupling is necessary (and actually beneficial), but could certainly be made more robust.
@mcyenikoylu Thanks - can you open a new issue for tracking this, with repro details?
@mcyenikoylu Thanks - can you open a new issue for tracking this, with repro details?
I got a same error. so, I tried ghost1372's suggestion. but I got a following error message:
error NETSDK1112: The runtime pack for Microsoft.Windows.SDK.NET.Ref was not downloaded. Try running a NuGet restore with the RuntimeIdentifier 'any'.
How can I fix it?
I got a same error. so, I tried ghost1372's suggestion. but I got a following error message:
error NETSDK1112: The runtime pack for Microsoft.Windows.SDK.NET.Ref was not downloaded. Try running a NuGet restore with the RuntimeIdentifier 'any'.
How can I fix it?
@c00012 Did you add a WindowsSdkPackageVersion project property with the value suggested in the build error?
@c00012 You might also want to make sure that nuget restore did run without issues after you added that property. I have seen this message when the nuget package didn't get restored.
Adding will fix issue
<WindowsSdkPackageVersion>10.0.20348.38</WindowsSdkPackageVersion>
In the most recent update of Visual Studio (17.11.5) this issue is fixed for us (without needing csproj shenanigans).
Thanks
In the most recent update of Visual Studio (17.11.5) this issue is fixed for us (without needing csproj shenanigans).
Thanks
Confirmed. After updating Visual Studio from 17.11.4 to 17.11.5, the problem is solved and no strange trick is required.
Thanks.
Describe the bug
Have been building a complex WinUI application (3 yrs old) with no issues using Microsoft.WindowsAppSDK ver. 1.5.240802000. Got a notice that a newer version of the package was available, and upgraded. Now my application build spews out a ton of missing target and conflict errors and won't build.
Steps to reproduce the bug
Expected behavior
I expect the builds to finish with no warnings or errors.
Screenshots
NuGet package version
Windows App SDK 1.6.0: 1.6.240829007
Packaging type
Packaged (MSIX), Unpackaged
Windows version
Windows 11 version 21H2 (22000)
IDE
Visual Studio 2022
Additional context
No response