WindowsAppSDK icon indicating copy to clipboard operation
WindowsAppSDK copied to clipboard

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

Open Scottj1s opened this issue 5 months ago • 6 comments

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 is sometimes necessary for a project to override the version of the Windows SDK projection 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

Scottj1s avatar Sep 19 '24 20:09 Scottj1s