Hi @Eduardo Gomez ,
Thanks for reaching out.
I will address each issue:
- C# version /
partialerror
“The modifier 'partial' is not valid for this item in C# 12.0…”
Even though you’ve set:
<LangVersion>preview</LangVersion>
the key detail is that preview maps to different C# versions depending on your installed .NET SDK.
If your SDK is older, preview may still resolve to C# 12, but partial properties (used by the latest MVVM Toolkit source generators) require C# 13 preview.
Please run:
dotnet --version
If you’re below 8.0.400, update your .NET 8 SDK. In SDK 8.0.400+, preview correctly maps to C# 13 preview, and the partial error should go away without any other changes.
After updating, delete your bin and obj folders and rebuild.
-
[ObservableProperty]error
“Using [ObservableProperty] on partial properties requires the C# language version to be set to 'preview'.”
This is actually a side effect of the first issue.
Starting with CommunityToolkit.Mvvm 8.2+, the toolkit supports a new partial-property style that relies on C# 13 features.
You now have two valid patterns:
Field-based (works in C# 12 and earlier):
[ObservableProperty]
private string? _name;
Partial-property style (requires C# 13 preview):
[ObservableProperty]
public partial string? Name { get; set; }
Just make sure you're not mixing styles in the same project, and that your SDK supports C# 13 preview.
- Windows SDK /
UseUwperror
“This project has a transitive dependency on the full Windows SDK projections…”
This typically happens when something in your dependency chain pulls in Windows.UI.Xaml.* types.
Since you're building a WinUI 3 desktop app (not a UWP app), this setting does not mean you’re converting your app to UWP. It simply enables the correct Windows projection behavior for interop.
Add this inside your existing <PropertyGroup>:
<UseUwp>true</UseUwp>
Also, I’d recommend removing this line if present:
<WinUISDKReferences>false</WinUISDKReferences>
Let the SDK manage its references automatically unless you have a specific reason to override it.
Before rebuilding:
- Run
dotnet --version-> update to 8.0.400+ if needed - Ensure
<LangVersion>preview</LangVersion>is set - Add
<UseUwp>true</UseUwp> - Confirm
CommunityToolkit.Mvvmis 8.2.0 or later - Delete
binandobj, then rebuild
Hope this helps! If my answer was helpful - kindly follow the instructions here so others with the same problem can benefit as well.