microsoft-ui-xaml icon indicating copy to clipboard operation
microsoft-ui-xaml copied to clipboard

When creating a new WinUI project in Visual Studio, it doesn't work

Open branislavjuhaas opened this issue 1 year ago • 5 comments

Describe the bug

When creating a new project, it doesn't build, but just writes, even reinstalling Visual Studio with all of the dependencies doesn't help. In addition, the fun part is that the .NET SDKs listed in the error cannot be downloaded and as of right now the last released version of SDK is 8.0.401, but it requires 402:

Severity Code Description Project File Line Suppression State Error (active) This version of the Windows App SDK requires Microsoft.Windows.SDK.NET.Ref 10.0.19041.38 or later. Please update to .NET SDK 6.0.134, 6.0.426, 8.0.109, 8.0.305 or 8.0.402 (or later). Or add a temporary Microsoft.Windows.SDK.NET.Ref reference which can be added with: <PropertyGroup> <WindowsSdkPackageVersion>10.0.19041.38</WindowsSdkPackageVersion> </PropertyGroup> wooooork C:\Users\juhas.nuget\packages\microsoft.windowsappsdk\1.6.240829007\buildTransitive\Microsoft.WindowsAppSDK.targets 76

Steps to reproduce the bug

  1. Create a new WinUI C# project in visual studio
  2. Try to build

Expected behavior

No response

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.6.0: 1.6.240829007

Windows version

Windows 11 (22H2): Build 22621

Additional context

No response

branislavjuhaas avatar Sep 21 '24 14:09 branislavjuhaas

It's really a known issue of unsynchronized release. WASDK 1.6 introduces breaking change in dependency, but released before it gets synchronized into .NET SDK. It's already checked into 8.0.402 but not reaching the release date.

huoyaoyuan avatar Sep 22 '24 07:09 huoyaoyuan

@huoyaoyuan, do you have any idea, how to hotfix this? I'd like to create a WinUI new project, but right now, I am quite stack because of this.

branislavjuhaas avatar Sep 22 '24 07:09 branislavjuhaas

The workaround is shown the error message that add a temporary <WindowsSdkPackageVersion>. Then everything should build.

huoyaoyuan avatar Sep 22 '24 09:09 huoyaoyuan

Can you post a video so we can see how to solve the issue?

AJsuper007 avatar Sep 24 '24 18:09 AJsuper007

@AJsuper007 I have made a video which showcases the workaround @huoyaoyuan recommended. My Error is different, but it is resolved with the same method. https://youtu.be/B0EcMfr9INw

I added <WindowsSdkPackageVersion>10.0.22621.38</WindowsSdkPackageVersion> to my PropertyGroup section in the csproj file.

If you are targeting 19041 instead, you would add <WindowsSdkPackageVersion>10.0.19041.38</WindowsSdkPackageVersion>

Skittles2519 avatar Sep 29 '24 06:09 Skittles2519

@branislavjuhas Creating a new project now, seems to work fine for me. Are you still able to reproduce this?

marcelwgn avatar Nov 28 '24 14:11 marcelwgn

It should be already fixed by October or November release of Visual Studio.

huoyaoyuan avatar Nov 28 '24 15:11 huoyaoyuan

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment.