Skip to content

[Feature Request] Add support for netstandard2.0 on FluentValidation.AutoValidation.Mvc #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
julealgon opened this issue Apr 1, 2025 · 1 comment

Comments

@julealgon
Copy link

I'd like to request support for targeting netstandard2.0 in the FluentValidation.AutoValidation.Mvc project so that it can work seamlessly in projects currently relying on AspNetCore libraries targeting older versions of the framework such as NET472.

For context, we have a large solution today with a couple of projects that use various Microsoft.AspNetCore.Mvc.* v2.2.0 and v2.3.0 packages targeting NET472. While we do have the intention of migrating those projects to modern .NET (8 and upwards), we won't be able to perform this upgrade right now.

At the same time, we would like to be able to upgrade our dependencies to modern versions, one of which is our FluentValidation dependency. We are currently using FluentValidation v10 (we created a temporary port of FluentValidation.AspNetCore that targets netstandard2.0 to make that work), but to be able to move to v11 we need support for automatic async validation, which v11 removed.

To completely eliminate our dependency on FluentValidation.AspNetCore, we would like to use FluentValidation.AutoValidation.Mvc instead. However, your library currently doesn't support netstandard2.0, and thus we are stuck.

I cloned the repository and made what I believe would be a "quick" job of supporting netstandard2.0 here for reference:

I made a couple of compromises in there:

  1. Removed support for ValidationStrategy.Annotations and AutoValidateNeverAttribute as those were based on the new Endpoints model.
    This could probably be changed to something else in the old framework and still be 100% compatible, but I just wanted to see if I could make the project build while targeting netstandard2.0

  2. Removed support for ProblemDetailsFactory and used ValidationProblemDetails directly
    ProblemDetailsFactory was introduced in AspNetCore 3.0 so that one is unavailable. The simplified version for 2.x should work just fine however.

@mvdgun
Copy link
Member

mvdgun commented Apr 7, 2025

Hi there! Thank you for your contributions. I don't plan on supporting netstandard2.0 in the foreseeable future. However, should enough people need this I am open to start supporting it.

I will keep this issue open to gather feedback from the community.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants