microsoft / microsoft/WindowsAppSDK

Windows App SDK new projects should automatically set a default TFM and Windows SDK package version, as necessary

Open
#4,734 6 comments 1 reaction 0 assignees View on GitHub
area-DeveloperTools
Dominant language
C++
Stars
4.7k
Forks
471
Avg merge
3d 13h
Merged PRs (30d)
28

Description

### Describe the bug

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 to maintain compatibility (e.g., with the introduction of AOT support in Windows App SDK 1.6). But since they are released independently, setting [WindowsSdkPackageVersion](https://learn.microsoft.com/en-us/dotnet/core/compatibility/sdk/5.0/override-windows-sdk-package-version) is sometimes necessary for a project to override the version of the [Windows SDK projection](https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref) implied by the TFM and the current .NET SDK. Microsoft.WindowsAppSDK.targets attempts to be helpful here, reporting an error indicating the project edits necessary to resolve potential runtime incompatibility errors. This behavior is a sharp edge, as the required user action is not simple or obvious. Ideally, the Windows App SDK would automatically default the Windows SDK projection to the revision necessary to ensure compat (e.g., 38). The same consideration should apply to generating a default TFM, with a minimum .NET version required. Both project creation and update scenarios should be supported.

### Steps to reproduce the bug

1. Create a new C# WinUI project, or update an existing one, referencing Windows App SDK 1.6
2. Build
3. An error results, informing the user of the need to override the Windows SDK package version, via WindowsSdkPackageVersion

### Expected behavior

A new project should build and run without error

### Screenshots

_No response_

### NuGet package version

Windows App SDK 1.6.0: 1.6.240829007

### Packaging type

_No response_

### Windows version

_No response_

### IDE

_No response_

### Additional context

_No response_

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue by creating or updating a C# WinUI project that references Windows App SDK 1.6, then inspect the Microsoft.WindowsAppSDK.targets behavior described in the report. Done means both project creation and update scenarios build and run without requiring a manual WindowsSdkPackageVersion override or an incompatible default TFM.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.