Install and reference
Add the NuGet package to a Prism app that uses BindableBase (or a compatible base). Use partial types where the generator requires them.
1. Add the package
Install MvvmAIO.Prism.SourceGenerators from NuGet. It bundles the Core attributes assembly.
dotnet add package MvvmAIO.Prism.SourceGenerators2. Use partial types
Annotate partial classes so the generator can extend them. Fix PSG0001–PSG0004 with the MakePartial code fix when offered.
public partial class MainViewModel : BindableBase
{
[ObservableProperty]
private string _title = "";
}3. Prism 8 vs 9
On Prism.Core 8.1.97 you may also need MvvmAIO.Prism.Bcl.Commands for AsyncDelegateCommand. Prism 9 includes async commands in-box.
dotnet add package MvvmAIO.Prism.Bcl.Commands4. Run the samples
Clone Prism.SourceGenerators.Samples for Avalonia demos targeting Prism 8 and Prism 9, then build Prism.SourceGenerators.Samples.slnx. Layout, validation demo, and local vs NuGet generator wiring are covered on Samples.
Requirements
- .NET 10 SDK
- Visual Studio 2022 17.13+ / Rider / VS Code with C# Dev Kit (
.slnxsupport) - Prism app with
BindableBase(or compatible base type)
Recommended package setup
MvvmAIO.Prism.SourceGenerators bundles source generator attributes from MvvmAIO.Prism.Core. For Prism.Core 8.1.97 async commands, add MvvmAIO.Prism.Bcl.Commands manually.
<ItemGroup>
<PackageReference Include="MvvmAIO.Prism.SourceGenerators" Version="0.6.0" />
<!-- Prism 8.1.97 async command support -->
<PackageReference Include="MvvmAIO.Prism.Bcl.Commands" Version="0.6.0" />
</ItemGroup>Replace versions with the latest from NuGet.
Build and validate
Build product solution:
dotnet build Prism.SourceGenerators.slnxRun CI-like local pipeline (Nuke) from the main generator repo:
dotnet run --project build/_build.csproj -- --target Ci --configuration ReleaseCommon upgrade notes
- C# 13+ supports partial-property
[ObservableProperty]targets using thefieldkeyword. - C# 14+ command generation can use
fielddirectly (no private backing field). ValueTask/ValueTask<T>execute methods are supported by async command generation via.AsTask().- If async command symbols are missing, the generator reports PSG3002 with package guidance.