Incorrect v1.6exp1 error
Describe the bug
When adding the latest 1.6.240531000-experimental1 nuget package, I'm met with the following error:
1>C:\Users\mn\.nuget\packages\microsoft.windowsappsdk\1.6.240531000-experimental1\buildTransitive\Microsoft.WindowsAppSDK.targets(84,9): error : This version of the Windows App SDK requires Microsoft.Windows.SDK.NET.Ref 10.0.19041.35-preview;10.0.19041.35-preview or later, which can be added with:
1>C:\Users\mn\.nuget\packages\microsoft.windowsappsdk\1.6.240531000-experimental1\buildTransitive\Microsoft.WindowsAppSDK.targets(84,9): error : <PropertyGroup>
1>C:\Users\mn\.nuget\packages\microsoft.windowsappsdk\1.6.240531000-experimental1\buildTransitive\Microsoft.WindowsAppSDK.targets(84,9): error : <WindowsSdkPackageVersion>10.0.19041.35-preview;10.0.19041.35-preview</WindowsSdkPackageVersion>
1>C:\Users\mn\.nuget\packages\microsoft.windowsappsdk\1.6.240531000-experimental1\buildTransitive\Microsoft.WindowsAppSDK.targets(84,9): error : </PropertyGroup>
1>C:\Users\mn\.nuget\packages\microsoft.windowsappsdk\1.6.240531000-experimental1\buildTransitive\Microsoft.WindowsAppSDK.targets(84,9): error :
Adding this to the project will result in a build-error. The string
10.0.19041.35-preview;10.0.19041.35-preview
should be changed to
10.0.19041.35-preview
Steps to reproduce the bug
- Create a new WinUI project.
- Update the nuget package to latest WindowsAppSDK 1.6.240531000-experimental1
Expected behavior
Don't repeat the version number inside the WindowsSdkPackageVersion tag twice
1>C:\Users\mn\.nuget\packages\microsoft.windowsappsdk\1.6.240531000-experimental1\buildTransitive\Microsoft.WindowsAppSDK.targets(84,9): error : This version of the Windows App SDK requires Microsoft.Windows.SDK.NET.Ref 10.0.19041.35-preview;10.0.19041.35-preview or later, which can be added with:
1>C:\Users\mn\.nuget\packages\microsoft.windowsappsdk\1.6.240531000-experimental1\buildTransitive\Microsoft.WindowsAppSDK.targets(84,9): error : <PropertyGroup>
1>C:\Users\mn\.nuget\packages\microsoft.windowsappsdk\1.6.240531000-experimental1\buildTransitive\Microsoft.WindowsAppSDK.targets(84,9): error : <WindowsSdkPackageVersion>10.0.19041.35-preview</WindowsSdkPackageVersion>
1>C:\Users\mn\.nuget\packages\microsoft.windowsappsdk\1.6.240531000-experimental1\buildTransitive\Microsoft.WindowsAppSDK.targets(84,9): error : </PropertyGroup>
1>C:\Users\mn\.nuget\packages\microsoft.windowsappsdk\1.6.240531000-experimental1\buildTransitive\Microsoft.WindowsAppSDK.targets(84,9): error :
Screenshots
NuGet package version
Windows App SDK 1.6 Experimental 1: 1.6.240531000-experimental1
Packaging type
No response
Windows version
Windows 11 version 22H2 (22621, 2022 Update)
IDE
Visual Studio 2022
Additional context
No response
Thanks @dotMorten - will be fixed in the Experimental 3 release.
The error message indicates that you need to add somewhere:
<PropertyGroup>
<WindowsSdkPackageVersion>10.0.19041.35-preview;10.0.19041.35-preview</WindowsSdkPackageVersion>
</PropertyGroup>
and when you double-click the error message, it opens the file Microsoft.WindowsAppSDK.targets which is inside the cached NuGet packages. If possible, it might be better if it opens the project file instead.
That's not quite how errors thrown by build .target files work though. Visual studio opens build errors where they occur
Yeah. I figured. How about mentioning "project file" in the error message? I think that it's confusing for devs new with .NET projects😅
Fixed in WinAppSDK 1.6 Preview 2
Had the same error with a new freshly made project in VS 2022. Fixed it by adding:
<WindowsSdkPackageVersion>10.0.26100.38</WindowsSdkPackageVersion>
after
<TargetFramework>net8.0-windows10.0.26100.0</TargetFramework>
<SupportedOSPlatformVersion>10.0.20348.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
@gabriel-vanca the issue was that error message was wrong (values repeated). Already fixed in 1.6.0
Well, I'm on version 1.6 and I'm still having the issue. Unless I've seriously misconfigured something.
@gabriel-vanca The generated error isn't the bug (it's actually quite helpful since it is required for now - see release notes). The message in the error was the issue and it is fixed.
The error before the fix was:
<WindowsSdkPackageVersion>10.0.19041.35-preview;10.0.19041.35-preview</WindowsSdkPackageVersion>
where the error was supposed to be:
<WindowsSdkPackageVersion>10.0.19041.35-preview</WindowsSdkPackageVersion>
Your screenshot confirms you have the correct message.
Get it now. Thanks!
I create a new empty WinUI3 project and it doesn't compile. Isn't this an error, you say? :)
Yes, I agree a default template not compiling should be treated more seriously.
Tracking future improvement here via #4734.