FluentValidation 12.1.1

FluentValidation is validation library for .NET that uses a fluent interface and lambda expressions for building strongly-typed validation rules.

Supporting the project

If you use FluentValidation in a commercial project, please sponsor the project financially. FluentValidation is developed and supported by @JeremySkinner for free in his spare time and financial sponsorship helps keep the project going. You can sponsor the project via either GitHub sponsors or OpenCollective.

Example

With FluentValidation, you can define a class that inherits from AbstractValidator which contains the rules for a particular class. The example below shows how you could define rules for a Customer class, and then how to execute the validator.

using FluentValidation;

public class CustomerValidator: AbstractValidator<Customer> {
  public CustomerValidator() {
    RuleFor(x => x.Surname).NotEmpty();
    RuleFor(x => x.Forename).NotEmpty().WithMessage("Please specify a first name");
    RuleFor(x => x.Discount).NotEqual(0).When(x => x.HasDiscount);
    RuleFor(x => x.Address).Length(20, 250);
    RuleFor(x => x.Postcode).Must(BeAValidPostcode).WithMessage("Please specify a valid postcode");
  }

  private bool BeAValidPostcode(string postcode) {
    // custom postcode validating logic goes here
  }
}

var customer = new Customer();
var validator = new CustomerValidator();

// Execute the validator.
ValidationResult results = validator.Validate(customer);

// Inspect any validation failures.
bool success = results.IsValid;
List<ValidationFailure> failures = results.Errors;

Full Documentation

Full documentation can be found at https://docs.fluentvalidation.net

Release Notes and Change Log

Release notes can be found on GitHub.

Showing the top 20 packages that depend on FluentValidation.

Packages Downloads
FluentValidation.AspNetCore
AspNetCore integration for FluentValidation
127
FluentValidation.AspNetCore
AspNetCore integration for FluentValidation
128
FluentValidation.AspNetCore
AspNetCore integration for FluentValidation
129
FluentValidation.AspNetCore
AspNetCore integration for FluentValidation
148
FluentValidation.AspNetCore
AspNetCore integration for FluentValidation
168
FluentValidation.AspNetCore
AspNetCore integration for FluentValidation
276
FluentValidation.AspNetCore
AspNetCore integration for FluentValidation
423
FluentValidation.AspNetCore
AspNetCore integration for FluentValidation
1,093
FluentValidation.DependencyInjectionExtensions
Dependency injection extensions for FluentValidation
127
FluentValidation.DependencyInjectionExtensions
Dependency injection extensions for FluentValidation
130
FluentValidation.DependencyInjectionExtensions
Dependency injection extensions for FluentValidation
135
FluentValidation.DependencyInjectionExtensions
Dependency injection extensions for FluentValidation
157
FluentValidation.DependencyInjectionExtensions
Dependency injection extensions for FluentValidation
172
FluentValidation.DependencyInjectionExtensions
Dependency injection extensions for FluentValidation
314
FluentValidation.DependencyInjectionExtensions
Dependency injection extensions for FluentValidation
379
RulesEngine
Rules Engine is a package for abstracting business logic/rules/policies out of the system. This works in a very simple way by giving you an ability to put your rules in a store outside the core logic of the system thus ensuring that any change in rules doesn't affect the core system.
156
RulesEngine
Rules Engine is a package for abstracting business logic/rules/policies out of the system. This works in a very simple way by giving you an ability to put your rules in a store outside the core logic of the system thus ensuring that any change in rules doesn't affect the core system.
176
RulesEngine
Rules Engine is a package for abstracting business logic/rules/policies out of the system. This works in a very simple way by giving you an ability to put your rules in a store outside the core logic of the system thus ensuring that any change in rules doesn't affect the core system.
237
RulesEngine
Rules Engine is a package for abstracting business logic/rules/policies out of the system. This works in a very simple way by giving you an ability to put your rules in a store outside the core logic of the system thus ensuring that any change in rules doesn't affect the core system.
392
RulesEngine
Rules Engine is a package for abstracting business logic/rules/policies out of the system. This works in a very simple way by giving you an ability to put your rules in a store outside the core logic of the system thus ensuring that any change in rules doesn't affect the core system.
549

FluentValidation 12 is a major release. Please read the upgrade guide at https://docs.fluentvalidation.net/en/latest/upgrading-to-12.html Full release notes can be found at https://github.com/FluentValidation/FluentValidation/releases

.NET 8.0

  • No dependencies.

Version Downloads Last updated
12.1.1 20 12/04/2025
12.1.0 114 11/04/2025
12.0.0 314 05/06/2025
12.0.0-preview1 80 01/03/2025
11.12.0 45 11/07/2025
11.11.0 259 11/20/2024
11.10.0 333 09/20/2024
11.9.2 246 06/27/2024
11.9.1 117 07/22/2024
11.9.0 270 02/05/2024
11.8.1 151 07/22/2024
11.8.0 108 07/22/2024
11.7.1 96 07/22/2024
11.7.0 107 07/22/2024
11.6.0 107 07/22/2024
11.5.2 102 07/22/2024
11.5.1 253 02/04/2024
11.5.0 102 07/22/2024
11.4.0 104 07/17/2024
11.3.0 131 02/04/2024
11.2.2 106 07/22/2024
11.2.1 113 07/22/2024
11.2.0 114 07/22/2024
11.1.1 107 07/22/2024
11.1.0 108 07/13/2024
11.0.3 119 07/22/2024
11.0.2 103 07/22/2024
11.0.1 98 07/22/2024
11.0.0 105 07/22/2024
10.4.0 211 02/04/2024
10.3.6 104 07/22/2024
10.3.5 96 07/22/2024
10.3.4 114 07/17/2024
10.3.3 116 07/17/2024
10.3.1 121 07/22/2024
10.3.0 100 05/29/2024
10.2.3 116 07/22/2024
10.2.2 102 07/22/2024
10.2.1 96 07/22/2024
10.2.0 107 07/22/2024
10.1.0 112 07/22/2024
10.0.4 112 07/22/2024
9.5.4 122 07/22/2024
9.5.3 105 07/22/2024
9.5.2 114 07/22/2024
9.5.1 104 07/22/2024
9.5.0 124 02/09/2024
9.4.0 106 07/22/2024
9.3.0 112 07/22/2024
9.3.0-preview3 112 07/22/2024
9.3.0-preview2 107 07/22/2024
9.3.0-preview1 120 07/22/2024
9.2.2 106 07/22/2024
9.2.1 106 07/18/2024
9.2.0 97 07/22/2024
9.1.3 121 07/22/2024
9.1.2 107 07/22/2024
9.1.1 99 07/22/2024
9.1.0 106 07/22/2024
9.0.1 112 07/22/2024
9.0.0-preview5 109 07/22/2024
9.0.0-preview4 99 07/22/2024
9.0.0-preview3 115 07/22/2024
9.0.0-preview2 102 07/22/2024
9.0.0-preview1 108 07/22/2024
8.6.3 111 07/22/2024
8.6.2 97 07/22/2024
8.6.1 105 07/22/2024
8.6.0 106 07/22/2024
8.5.1 111 07/21/2024
8.5.0 111 07/18/2024
8.5.0-preview5 112 07/22/2024
8.5.0-preview4 106 07/22/2024
8.5.0-preview3 102 07/22/2024
8.5.0-preview2 114 07/22/2024
8.5.0-preview1 104 07/22/2024
8.4.0 116 07/22/2024
8.3.0 114 07/22/2024
8.2.3 108 07/22/2024
8.2.2 102 07/22/2024
8.2.1 110 07/22/2024
8.2.0 116 07/22/2024
8.1.3 118 07/22/2024
8.1.2 98 07/22/2024
8.1.1 103 07/22/2024
8.1.0 117 07/22/2024
8.1.0-preview2 104 07/22/2024
8.1.0-preview1 115 07/22/2024
8.0.101 110 07/22/2024
8.0.100 101 07/17/2024
8.0.0 101 07/22/2024
8.0.0-rc1 117 07/22/2024
8.0.0-preview4 103 07/22/2024
8.0.0-preview3 112 07/22/2024
8.0.0-preview2 114 07/22/2024
7.6.105 104 07/22/2024
7.6.104 109 07/22/2024
7.6.103 97 07/22/2024
7.6.102 110 07/22/2024
7.6.101 104 07/22/2024
7.6.100 116 07/22/2024
7.6.0 119 07/22/2024
7.6.0-preview1 112 07/22/2024
7.5.2 107 07/22/2024
7.5.1 99 06/21/2024
7.5.0 114 07/22/2024
7.4.0 110 07/22/2024
7.3.4 101 07/22/2024
7.3.3 109 07/22/2024
7.3.2 105 07/22/2024
7.3.1 108 07/22/2024
7.3.0 105 07/22/2024
7.3.0-beta3 115 07/22/2024
7.3.0-beta2 113 07/22/2024
7.3.0-beta1 118 07/22/2024
7.2.1 113 07/22/2024
7.2.0 109 07/22/2024
7.2.0-beta3 106 07/22/2024
7.2.0-beta2 115 07/22/2024
7.2.0-beta1 116 07/22/2024
7.1.1 103 07/22/2024
7.1.0 97 07/22/2024
7.1.0-beta1 101 07/22/2024
7.0.3 104 07/22/2024
7.0.2 99 07/22/2024
7.0.1 125 07/22/2024
7.0.0 105 07/22/2024
7.0.0-beta3 100 07/22/2024
7.0.0-beta2 104 07/22/2024
7.0.0-beta1 95 07/22/2024
6.4.1 120 07/22/2024
6.4.1-beta1 130 07/22/2024
6.4.0 111 07/22/2024
6.4.0-rc4 131 07/22/2024
6.4.0-rc3 106 07/22/2024
6.4.0-rc2 118 07/22/2024
6.4.0-rc1 119 07/22/2024
6.4.0-beta9 142 07/22/2024
6.4.0-beta8 144 07/22/2024
6.4.0-beta7 111 07/22/2024
6.4.0-beta6 117 07/22/2024
6.4.0-beta5 119 07/22/2024
6.4.0-beta4 116 07/22/2024
6.4.0-beta3 107 07/22/2024
6.4.0-beta2 116 07/22/2024
6.4.0-beta10 128 07/22/2024
6.4.0-beta1 95 07/22/2024
6.3.4-alpha 110 07/22/2024
6.3.3-alpha 100 07/22/2024
6.2.1 106 07/22/2024
6.2.1-beta1 105 07/22/2024
6.2.0 96 07/22/2024
6.2.0-beta1 111 07/22/2024
6.1.0 109 07/22/2024
6.0.2 98 07/22/2024
6.0.1 104 07/22/2024
6.0.0 116 07/22/2024
5.6.2 115 07/22/2024
5.6.1 114 07/22/2024
5.5.0 112 07/22/2024
5.4.0 116 07/22/2024
5.3.0 113 07/21/2024
5.2.0 110 07/22/2024
5.1.0 116 07/22/2024
5.0.0.1 112 07/22/2024
4.0.0.1 116 07/22/2024
4.0.0 121 07/22/2024
3.4.6 104 07/22/2024
3.4.0 107 07/22/2024
3.3.1 112 07/22/2024
3.2.0 123 07/22/2024
3.1.0 111 07/22/2024
3.0.0.1 97 07/22/2024
3.0.0 118 07/22/2024
2.0.0 99 07/22/2024
1.3.0 111 07/22/2024