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
121
FluentValidation.AspNetCore
AspNetCore integration for FluentValidation
122
FluentValidation.AspNetCore
AspNetCore integration for FluentValidation
141
FluentValidation.AspNetCore
AspNetCore integration for FluentValidation
162
FluentValidation.AspNetCore
AspNetCore integration for FluentValidation
236
FluentValidation.AspNetCore
AspNetCore integration for FluentValidation
338
FluentValidation.AspNetCore
AspNetCore integration for FluentValidation
1,052
FluentValidation.DependencyInjectionExtensions
Dependency injection extensions for FluentValidation
119
FluentValidation.DependencyInjectionExtensions
Dependency injection extensions for FluentValidation
120
FluentValidation.DependencyInjectionExtensions
Dependency injection extensions for FluentValidation
128
FluentValidation.DependencyInjectionExtensions
Dependency injection extensions for FluentValidation
150
FluentValidation.DependencyInjectionExtensions
Dependency injection extensions for FluentValidation
159
FluentValidation.DependencyInjectionExtensions
Dependency injection extensions for FluentValidation
258
FluentValidation.DependencyInjectionExtensions
Dependency injection extensions for FluentValidation
356
FluentValidation.DependencyInjectionExtensions
Dependenecy injection extensions for FluentValidation
119
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.
150
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.
161
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.
212
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.
307
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.
539

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 5 12/04/2025
12.1.0 75 11/04/2025
12.0.0 268 05/06/2025
12.0.0-preview1 74 01/03/2025
11.12.0 30 11/07/2025
11.11.0 225 11/20/2024
11.10.0 319 09/20/2024
11.9.2 239 06/27/2024
11.9.1 111 07/22/2024
11.9.0 259 02/05/2024
11.8.1 145 07/22/2024
11.8.0 102 07/22/2024
11.7.1 90 07/22/2024
11.7.0 99 07/22/2024
11.6.0 100 07/22/2024
11.5.2 93 07/22/2024
11.5.1 239 02/04/2024
11.5.0 94 07/22/2024
11.4.0 98 07/17/2024
11.3.0 117 02/04/2024
11.2.2 100 07/22/2024
11.2.1 104 07/22/2024
11.2.0 106 07/22/2024
11.1.1 98 07/22/2024
11.1.0 100 07/13/2024
11.0.3 109 07/22/2024
11.0.2 97 07/22/2024
11.0.1 91 07/22/2024
11.0.0 101 07/22/2024
10.4.0 200 02/04/2024
10.3.6 97 07/22/2024
10.3.5 89 07/22/2024
10.3.4 105 07/17/2024
10.3.3 106 07/17/2024
10.3.1 112 07/22/2024
10.3.0 92 05/29/2024
10.2.3 104 07/22/2024
10.2.2 96 07/22/2024
10.2.1 88 07/22/2024
10.2.0 99 07/22/2024
10.1.0 106 07/22/2024
10.0.4 103 07/22/2024
9.5.4 112 07/22/2024
9.5.3 97 07/22/2024
9.5.2 107 07/22/2024
9.5.1 96 07/22/2024
9.5.0 116 02/09/2024
9.4.0 99 07/22/2024
9.3.0 96 07/22/2024
9.3.0-preview3 101 07/22/2024
9.3.0-preview2 100 07/22/2024
9.3.0-preview1 104 07/22/2024
9.2.2 99 07/22/2024
9.2.1 101 07/18/2024
9.2.0 89 07/22/2024
9.1.3 108 07/22/2024
9.1.2 99 07/22/2024
9.1.1 91 07/22/2024
9.1.0 99 07/22/2024
9.0.1 107 07/22/2024
9.0.0-preview5 100 07/22/2024
9.0.0-preview4 93 07/22/2024
9.0.0-preview3 105 07/22/2024
9.0.0-preview2 94 07/22/2024
9.0.0-preview1 99 07/22/2024
8.6.3 104 07/22/2024
8.6.2 88 07/22/2024
8.6.1 98 07/22/2024
8.6.0 99 07/22/2024
8.5.1 101 07/21/2024
8.5.0 103 07/18/2024
8.5.0-preview5 108 07/22/2024
8.5.0-preview4 97 07/22/2024
8.5.0-preview3 91 07/22/2024
8.5.0-preview2 108 07/22/2024
8.5.0-preview1 95 07/22/2024
8.4.0 100 07/22/2024
8.3.0 107 07/22/2024
8.2.3 98 07/22/2024
8.2.2 94 07/22/2024
8.2.1 100 07/22/2024
8.2.0 107 07/22/2024
8.1.3 106 07/22/2024
8.1.2 89 07/22/2024
8.1.1 88 07/22/2024
8.1.0 105 07/22/2024
8.1.0-preview2 95 07/22/2024
8.1.0-preview1 108 07/22/2024
8.0.101 105 07/22/2024
8.0.100 94 07/17/2024
8.0.0 93 07/22/2024
8.0.0-rc1 108 07/22/2024
8.0.0-preview4 95 07/22/2024
8.0.0-preview3 98 07/22/2024
8.0.0-preview2 106 07/22/2024
7.6.105 97 07/22/2024
7.6.104 101 07/22/2024
7.6.103 90 07/22/2024
7.6.102 102 07/22/2024
7.6.101 95 07/22/2024
7.6.100 107 07/22/2024
7.6.0 108 07/22/2024
7.6.0-preview1 102 07/22/2024
7.5.2 98 07/22/2024
7.5.1 87 06/21/2024
7.5.0 104 07/22/2024
7.4.0 92 07/22/2024
7.3.4 93 07/22/2024
7.3.3 97 07/22/2024
7.3.2 94 07/22/2024
7.3.1 95 07/22/2024
7.3.0 95 07/22/2024
7.3.0-beta3 107 07/22/2024
7.3.0-beta2 101 07/22/2024
7.3.0-beta1 110 07/22/2024
7.2.1 102 07/22/2024
7.2.0 103 07/22/2024
7.2.0-beta3 97 07/22/2024
7.2.0-beta2 109 07/22/2024
7.2.0-beta1 101 07/22/2024
7.1.1 95 07/22/2024
7.1.0 91 07/22/2024
7.1.0-beta1 91 07/22/2024
7.0.3 97 07/22/2024
7.0.2 93 07/22/2024
7.0.1 118 07/22/2024
7.0.0 98 07/22/2024
7.0.0-beta3 91 07/22/2024
7.0.0-beta2 95 07/22/2024
7.0.0-beta1 86 07/22/2024
6.4.1 112 07/22/2024
6.4.1-beta1 122 07/22/2024
6.4.0 101 07/22/2024
6.4.0-rc4 122 07/22/2024
6.4.0-rc3 96 07/22/2024
6.4.0-rc2 108 07/22/2024
6.4.0-rc1 108 07/22/2024
6.4.0-beta9 136 07/22/2024
6.4.0-beta8 130 07/22/2024
6.4.0-beta7 105 07/22/2024
6.4.0-beta6 108 07/22/2024
6.4.0-beta5 108 07/22/2024
6.4.0-beta4 110 07/22/2024
6.4.0-beta3 92 07/22/2024
6.4.0-beta2 109 07/22/2024
6.4.0-beta10 116 07/22/2024
6.4.0-beta1 88 07/22/2024
6.3.4-alpha 101 07/22/2024
6.3.3-alpha 94 07/22/2024
6.2.1 97 07/22/2024
6.2.1-beta1 92 07/22/2024
6.2.0 87 07/22/2024
6.2.0-beta1 104 07/22/2024
6.1.0 98 07/22/2024
6.0.2 89 07/22/2024
6.0.1 94 07/22/2024
6.0.0 106 07/22/2024
5.6.2 108 07/22/2024
5.6.1 100 07/22/2024
5.5.0 100 07/22/2024
5.4.0 109 07/22/2024
5.3.0 105 07/21/2024
5.2.0 103 07/22/2024
5.1.0 109 07/22/2024
5.0.0.1 103 07/22/2024
4.0.0.1 108 07/22/2024
4.0.0 108 07/22/2024
3.4.6 94 07/22/2024
3.4.0 94 07/22/2024
3.3.1 103 07/22/2024
3.2.0 116 07/22/2024
3.1.0 103 07/22/2024
3.0.0.1 88 07/22/2024
3.0.0 108 07/22/2024
2.0.0 89 07/22/2024
1.3.0 105 07/22/2024