'using FluentValidation.DependencyInjectionExtensions with asp.net-core6

I need to register FluentValidation in core6 Program.cs project file

services.AddValidatorsFromAssembly(Assembly.GetExecutingAssembly());

And get an error

Cannot resolve scoped service 'Application.Validation.FluentValidation.ModelValidators.MyValidator' from root provider.

I have latest FluentValidation and FluentValidation.DependencyInjectionExtensions versions

<PackageReference Include="FluentValidation" Version="10.4.0" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="10.4.0" />


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source