Automatically set default WindowsSdkPackageVersion for Windows App SDK projects#6
Draft
Automatically set default WindowsSdkPackageVersion for Windows App SDK projects#6
Conversation
Co-authored-by: LegendaryBlair <122517415+LegendaryBlair@users.noreply.github.com>
Co-authored-by: LegendaryBlair <122517415+LegendaryBlair@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Windows App SDK new projects should automatically set a default TFM and Windows SDK package version, as necessary
Automatically set default WindowsSdkPackageVersion for Windows App SDK projects
May 22, 2025
LegendaryBlair
requested changes
May 23, 2025
| --> | ||
| <PropertyGroup Condition="'$(WindowsSdkPackageVersion)' == '' And '$(MSBuildProjectExtension)' == '.csproj'"> | ||
| <!-- Default to the Windows SDK version that is compatible with the current Windows App SDK --> | ||
| <WindowsSdkPackageVersion>10.0.17763.38</WindowsSdkPackageVersion> |
Owner
There was a problem hiding this comment.
It does not make sense to set default WindowsSdkPackageVersion to be 10.0.17763.38.
First, the target OS version is not necessarily to be 10.0.17763.0.
Secondly, the Cs/WinRT projection version 38 is a special case.
Author
There was a problem hiding this comment.
I've updated the code to address this issue in commit 3dab581. Instead of hardcoding 10.0.17763.38, I've implemented a more flexible solution that:
-
Introduces two new configurable properties:
WindowsAppSDKDefaultSdkVersion(defaults to10.0.17763)WindowsAppSDKCsWinRTProjectionVersion(dynamically usesCsWinRTDependencyWindowsSdkVersionSuffixPackageVersionwith fallback to38)
-
Constructs
WindowsSdkPackageVersiondynamically from these properties
This approach avoids hardcoding specific versions while still providing the necessary compatibility defaults. Projects can override either part of the version independently if needed.
…ersion Co-authored-by: LegendaryBlair <122517415+LegendaryBlair@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes an issue where Windows App SDK projects require manual configuration of the
WindowsSdkPackageVersionproperty to ensure compatibility between Windows App SDK and Windows SDK projections, particularly for AOT support in Windows App SDK 1.6+.Implementation
Created a new
Microsoft.WindowsAppSDK.CsWinRTCompatibility.targetsfile that:WindowsSdkPackageVersionto10.0.17763.38for C# projects when not specifiedUpdated
Microsoft.WindowsAppSDK.Foundation.targetsto import the new compatibility targets fileBenefits
WindowsSdkPackageVersionBefore this change, users would encounter an error message instructing them to add the
WindowsSdkPackageVersionproperty to their project file. Now, this property is set automatically to the correct value, ensuring compatibility between Windows App SDK 1.6+ and the Windows SDK projections.Fixes #5.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.