Skip to content

Commit 38c6f4a

Browse files
committed
Update CsWinRT references
1 parent 1abeff6 commit 38c6f4a

3 files changed

Lines changed: 15 additions & 14 deletions

File tree

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
- The recommended Windows SDK package for UWP projects using the .NET 9 SDK (with UWP XAML projections).
2828
- The recommended Windows SDK package for WindowsAppSDK projects (ie. without UWP XAML projections).
2929
-->
30-
<_MvvmToolkitWindowsSdkPackageMinBuild>38</_MvvmToolkitWindowsSdkPackageMinBuild>
31-
<_MvvmToolkitWindowsSdkPackageRecommendedUwpBuild>54</_MvvmToolkitWindowsSdkPackageRecommendedUwpBuild>
32-
<_MvvmToolkitWindowsSdkPackageRecommendedWindowsAppSDKBuild>53</_MvvmToolkitWindowsSdkPackageRecommendedWindowsAppSDKBuild>
30+
<_MvvmToolkitWindowsSdkPackageMinBuild>56</_MvvmToolkitWindowsSdkPackageMinBuild>
31+
<_MvvmToolkitWindowsSdkPackageRecommendedUwpBuild>57</_MvvmToolkitWindowsSdkPackageRecommendedUwpBuild>
32+
<_MvvmToolkitWindowsSdkPackageRecommendedWindowsAppSDKBuild>56</_MvvmToolkitWindowsSdkPackageRecommendedWindowsAppSDKBuild>
3333

3434
<!-- Switch on the recommended one based on configuration -->
3535
<_MvvmToolkitWindowsSdkPackageRecommendedBuild>$(_MvvmToolkitWindowsSdkPackageMinBuild)</_MvvmToolkitWindowsSdkPackageRecommendedBuild>
@@ -82,7 +82,7 @@
8282
Condition="'@(_MvvmToolkitCompatibleWindowsSdkPackages)' == ''"
8383
Code="MVVMTKCFG0003"
8484
HelpLink="https://aka.ms/mvvmtoolkit/errors/mvvmtkcfg0003"
85-
Text="This version of the MVVM Toolkit requires 'Microsoft.Windows.SDK.NET.Ref' version '$(_MvvmToolkitWindowsSdkPackageRequired)' or later. Please update to .NET SDK 8.0.109, 8.0.305 or 8.0.402 (or later). Alternatively, use a temporary 'Microsoft.Windows.SDK.NET.Ref' reference, which can be done by setting the 'WindowsSdkPackageVersion' property in your .csproj file. For your project configuration, it is recommended to set the package version to '$(_MvvmToolkitWindowsSdkPackageRecommended)'." />
85+
Text="This version of the MVVM Toolkit requires 'Microsoft.Windows.SDK.NET.Ref' version '$(_MvvmToolkitWindowsSdkPackageRequired)' or later. Please update the .NET SDK in use to 8.0.405 (or later) or 9.0.102 (or later). Alternatively, use a temporary 'Microsoft.Windows.SDK.NET.Ref' reference, which can be done by setting the 'WindowsSdkPackageVersion' property in your .csproj file. For your project configuration, it is recommended to set the package version to '$(_MvvmToolkitWindowsSdkPackageRecommended)'." />
8686
</Target>
8787

8888
</Project>

src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
because we need the source generators in CsWinRT to generate the supporting interop code for AOT).
1010
-->
1111
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0-windows10.0.17763.0'))">
12-
<WindowsSdkPackageVersion>10.0.17763.53</WindowsSdkPackageVersion>
12+
<WindowsSdkPackageVersion>10.0.17763.56</WindowsSdkPackageVersion>
1313

1414
<!--
1515
We're only referencing CsWinRT for the source generators, we don't need to read any WinRT metadata.
@@ -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.6" PrivateAssets="all" />
64+
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.2.0" 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 -->

src/CommunityToolkit.Mvvm/Messaging/IMessengerExtensions.Observables.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,9 @@
33
// See the LICENSE file in the project root for more information.
44

55
using System;
6-
7-
// This file has two types which implement interfaces that can be projected to WInRT, ie.
8-
// 'Observable<TMessage>.Recipient' and 'Observable<TMessage, TToken>.Recipient', which
9-
// implement 'IDisposable' (which is projected to 'IClosable'). These types are not meant
10-
// to be used in interop scenarios (including in eg. bindings), as they're only meant to
11-
// be used by code behind interacting with System.Reactive APIs. As such, we skip marking
12-
// them partial, as we don't need CCW vtables to be generated for them.
13-
#pragma warning disable CsWinRT1028
6+
#if NET8_0_OR_GREATER && WINDOWS
7+
using WinRT;
8+
#endif
149

1510
namespace CommunityToolkit.Mvvm.Messaging;
1611

@@ -81,6 +76,9 @@ public IDisposable Subscribe(IObserver<TMessage> observer)
8176
/// <summary>
8277
/// An <see cref="IRecipient{TMessage}"/> implementation for <see cref="Observable{TMessage}"/>.
8378
/// </summary>
79+
#if NET8_0_OR_GREATER && WINDOWS
80+
[WinRTExposedType(typeof(WinRTManagedOnlyTypeDetails))]
81+
#endif
8482
private sealed class Recipient : IRecipient<TMessage>, IDisposable
8583
{
8684
/// <summary>
@@ -159,6 +157,9 @@ public IDisposable Subscribe(IObserver<TMessage> observer)
159157
/// <summary>
160158
/// An <see cref="IRecipient{TMessage}"/> implementation for <see cref="Observable{TMessage, TToken}"/>.
161159
/// </summary>
160+
#if NET8_0_OR_GREATER && WINDOWS
161+
[WinRTExposedType(typeof(WinRTManagedOnlyTypeDetails))]
162+
#endif
162163
private sealed class Recipient : IRecipient<TMessage>, IDisposable
163164
{
164165
/// <summary>

0 commit comments

Comments
 (0)