MvvmAIO.Prism.SourceGenerators
0.4.1
See the version list below for details.
dotnet add package MvvmAIO.Prism.SourceGenerators --version 0.4.1
NuGet\Install-Package MvvmAIO.Prism.SourceGenerators -Version 0.4.1
<PackageReference Include="MvvmAIO.Prism.SourceGenerators" Version="0.4.1"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="MvvmAIO.Prism.SourceGenerators" Version="0.4.1" />
<PackageReference Include="MvvmAIO.Prism.SourceGenerators"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add MvvmAIO.Prism.SourceGenerators --version 0.4.1
#r "nuget: MvvmAIO.Prism.SourceGenerators, 0.4.1"
#:package MvvmAIO.Prism.SourceGenerators@0.4.1
#addin nuget:?package=MvvmAIO.Prism.SourceGenerators&version=0.4.1
#tool nuget:?package=MvvmAIO.Prism.SourceGenerators&version=0.4.1
MvvmAIO.Prism.SourceGenerators
Roslyn source generators for the Prism MVVM library — generate observable properties, delegate commands, and validation boilerplate at compile time.
Installation
<PackageReference Include="MvvmAIO.Prism.SourceGenerators" Version="0.2.0" />
Prism.Core 8.1.97 + async commands? Also install
MvvmAIO.Prism.Bcl.CommandsforAsyncDelegateCommand. Prism 9+ already ships these types.
Features at a Glance
| Attribute | What it generates |
|---|---|
[ObservableProperty] |
Property with SetProperty call, OnChanging/OnChanged hooks, INotifyPropertyChanging support |
[DelegateCommand] |
DelegateCommand / DelegateCommand<T> property |
[AsyncDelegateCommand] |
AsyncDelegateCommand / AsyncDelegateCommand<T> with fluent chaining |
[NotifyPropertyChangedFor] |
Extra PropertyChanged notifications for dependent properties |
[NotifyCanExecuteChangedFor] |
Auto RaiseCanExecuteChanged() on related commands |
[ObservesProperty] |
.ObservesProperty(() => Prop) on generated commands |
[NotifyDataErrorInfo] |
ValidateProperty() in setter via INotifyDataErrorInfo |
[BindableBase] |
Full INotifyPropertyChanged implementation on any class |
Quick Start
Observable Properties
using Prism.SourceGenerators;
public partial class MainViewModel : BindableBase
{
// Field target (all C# versions)
[ObservableProperty]
private string _title = "Hello";
// Partial property target (C# 13+)
[ObservableProperty]
public partial int Count { get; set; }
}
Commands
public partial class MainViewModel : BindableBase
{
[DelegateCommand]
private void Save() { /* ... */ }
[AsyncDelegateCommand(CanExecute = nameof(CanLoad))]
private async Task LoadAsync(CancellationToken ct) { /* ... */ }
private bool CanLoad() => !IsBusy;
}
Validation
using System.ComponentModel.DataAnnotations;
using Prism.SourceGenerators;
public partial class FormViewModel : BindableValidator
{
[ObservableProperty]
[NotifyDataErrorInfo]
[Required, MinLength(2)]
public partial string Username { get; set; }
[ObservableProperty]
[NotifyDataErrorInfo]
[Required, EmailAddress]
public partial string Email { get; set; }
}
The generated setter calls ValidateProperty(value, nameof(Property)) after setting the value. BindableValidator implements INotifyDataErrorInfo with ValidateProperty(), ValidateAllProperties(), ClearErrors(), and ClearAllErrors().
Property Change Notifications & Command Refresh
public partial class EditorViewModel : BindableBase
{
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(FullName))]
[NotifyCanExecuteChangedFor(nameof(SaveCommand))]
private string _firstName = "";
[DelegateCommand(CanExecute = nameof(CanSave))]
[ObservesProperty(nameof(FirstName))]
private void Save() { /* ... */ }
private bool CanSave() => !string.IsNullOrEmpty(FirstName);
public string FullName => $"{FirstName}";
}
BindableBase Generation
[BindableBase]
public partial class LightViewModel
{
// INotifyPropertyChanged + INotifyPropertyChanging + SetProperty<T> + RaisePropertyChanged
// all generated — no need to inherit from Prism.Mvvm.BindableBase
}
Diagnostics & Code Fixes
| ID | Severity | Description |
|---|---|---|
| PSG0001 | Error | Class with [ObservableProperty] must be partial |
| PSG0002 | Error | Class with [DelegateCommand]/[AsyncDelegateCommand] must be partial |
| PSG0003 | Error | Property with [ObservableProperty] must be partial |
| PSG0004 | Error | Class with [BindableBase] must be partial |
| PSG1001 | Error | Invalid [DelegateCommand] method signature |
| PSG1002 | Error | Invalid [AsyncDelegateCommand] method signature |
| PSG2001 | Warning | Catch handler not found |
| PSG2002 | Warning | Catch handler has incompatible signature |
| PSG2003 | Warning | CanExecute member not found |
| PSG2004 | Warning | Observed property not found |
| PSG2005 | Warning | [NotifyCanExecuteChangedFor] command not found |
| PSG2006 | Warning | CanExecute signature incompatible with command |
| PSG3002 | Error | AsyncDelegateCommand type not found (install MvvmAIO.Prism.Bcl.Commands for Prism 8) |
| PSG4001 | Warning | ServiceType not assignable from implementation |
| PSG4002 | Warning | ViewModelType could not be resolved |
| PSG5001 | Warning | [NotifyDataErrorInfo] requires BindableValidator base type |
PSG0001–PSG0004 have IDE quick fixes: Ctrl+. → add partial (supports "Fix all in document/project/solution").
Compatibility
| Supported | |
|---|---|
| .NET | 6.0+ / .NET Standard 2.0 |
| Prism | 8.1.97, 9.0+ |
| C# | 10+ (partial properties require C# 13+) |
| Roslyn | 4.0.1, 4.3.1, 4.12.0, 5.0.0 |
| IDE | Visual Studio 2022 17.13+, Rider, VS Code + C# Dev Kit |
Package Contents
This NuGet package includes:
- Roslyn analyzers (multi-targeted: Roslyn 4.0 / 4.3 / 4.12 / 5.0)
- MvvmAIO.Prism.Core library (attributes:
[ObservableProperty],[DelegateCommand],[AsyncDelegateCommand],[BindableBase],[NotifyPropertyChangedFor],[NotifyCanExecuteChangedFor],[ObservesProperty],[NotifyDataErrorInfo],BindableValidatorbase class) - This is a development dependency — no runtime DLLs are added to your output
Resources
License
MIT — see LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.5.1 | 0 | 5/31/2026 |
| 0.5.0 | 41 | 5/26/2026 |
| 0.4.3 | 43 | 5/26/2026 |
| 0.4.2 | 79 | 5/25/2026 |
| 0.4.1 | 98 | 5/16/2026 |
| 0.4.0 | 91 | 5/13/2026 |
| 0.3.1 | 87 | 5/5/2026 |
| 0.3.0 | 96 | 5/5/2026 |
| 0.2.2 | 91 | 5/1/2026 |
| 0.2.1 | 89 | 5/1/2026 |
| 0.2.0 | 88 | 5/1/2026 |
| 0.1.7 | 86 | 5/1/2026 |
| 0.1.5 | 93 | 4/30/2026 |
| 0.1.2 | 91 | 4/28/2026 |
| 0.1.1 | 98 | 4/28/2026 |
| 0.1.0 | 94 | 4/28/2026 |