Skip to content

Commit 760c8aa

Browse files
committed
Merge pull request #952 from CommunityToolkit/dev/update-framework-reference-checks
Update SDK package checks for .NET 9 SDK
1 parent 3c74216 commit 760c8aa

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.WindowsSdk.targets

+13-2
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,21 @@
4545
<Recommended>10.0.$([System.Version]::Parse("$(WindowsSdkPackageVersion.Split('-')[0])").Build).$(_MvvmToolkitWindowsSdkPackageRecommendedBuild)</Recommended>
4646
</_MvvmToolkitWindowsSdkPackage>
4747

48-
<!-- Otherwise, validate against the framework reference package -->
48+
<!--
49+
Otherwise, validate against the framework reference package. We need to check for two different item specs:
50+
- "Microsoft.Windows.SDK.NET.Ref": this is the default name for the framework reference for the Windows
51+
SDK projections, used on .NET 8 and lower. It includes all Windows APIs, except for XAML.
52+
- "Microsoft.Windows.SDK.NET.Ref.Windows": this is the same as bove, except it's the framework reference
53+
name that is added by the .NET 9 SDK for projects targeting .NET 8 and above. This specifically includes
54+
the "Windows" profile, which only references non-XAML APIs. This change was done for the UWP support for
55+
.NET 9, which requires the .NET SDK to also be able to reference XAML types. Those will use a different
56+
item spec (ie. "Microsoft.Windows.SDK.NET.Ref.Xaml"). We only need to check the base "Windows" reference.
57+
-->
4958
<_MvvmToolkitWindowsSdkPackage
5059
Include="@(ResolvedFrameworkReference)"
51-
Condition="'$(WindowsSdkPackageVersion)' == '' AND '@(ResolvedFrameworkReference)' != '' AND '%(Identity)' == 'Microsoft.Windows.SDK.NET.Ref'">
60+
Condition="'$(WindowsSdkPackageVersion)' == '' AND
61+
'@(ResolvedFrameworkReference)' != '' AND
62+
('%(Identity)' == 'Microsoft.Windows.SDK.NET.Ref' OR '%(Identity)' == 'Microsoft.Windows.SDK.NET.Ref.Windows')">
5263
<Referenced>%(ResolvedFrameworkReference.TargetingPackVersion)</Referenced>
5364
<Required>10.0.$([System.Version]::Parse("%(ResolvedFrameworkReference.TargetingPackVersion)").Build).$(_MvvmToolkitWindowsSdkPackageMinBuild)</Required>
5465
<Recommended>10.0.$([System.Version]::Parse("%(ResolvedFrameworkReference.TargetingPackVersion)").Build).$(_MvvmToolkitWindowsSdkPackageRecommendedBuild)</Recommended>

src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161

6262
<!-- Reference CsWinRT when targeting Windows, to get the latest source generators -->
6363
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0-windows10.0.17763.0'))">
64-
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.1.1" PrivateAssets="all" />
64+
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.1.3" PrivateAssets="all" />
6565
</ItemGroup>
6666

6767
<!-- Reference the various multi-targeted versions of the source generator project (one per Roslyn version), and the code fixer -->

0 commit comments

Comments
 (0)