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

vNext / MVC 6 Integration #98

Closed
endeffects opened this Issue Jul 30, 2015 · 139 comments

Comments

Projects
None yet
@endeffects

endeffects commented Jul 30, 2015

Hi,

i saw you have created a branch for vNext / Mvc6. When do you plan a beta / final release?

Regards

@JeremySkinner

This comment has been minimized.

Show comment
Hide comment
@JeremySkinner

JeremySkinner Jul 30, 2015

Owner

I am away with work until September, so I'm not going to have much chance to work on it until then I'm afraid. I expect mid/end September will be the earliest I can do an initial release (unless someone else wants to help out)

Owner

JeremySkinner commented Jul 30, 2015

I am away with work until September, so I'm not going to have much chance to work on it until then I'm afraid. I expect mid/end September will be the earliest I can do an initial release (unless someone else wants to help out)

@endeffects

This comment has been minimized.

Show comment
Hide comment
@endeffects

endeffects Jul 30, 2015

Thanks for your quick response. Than i have tu put this into my backlog. :)

endeffects commented Jul 30, 2015

Thanks for your quick response. Than i have tu put this into my backlog. :)

@ddotlic

This comment has been minimized.

Show comment
Hide comment
@ddotlic

ddotlic Sep 20, 2015

@JeremySkinner I might have some time to do this at work (win-win for everyone) since my employer needs this (we're starting our work on next major version of the product and we'll be depending on Fluent Validation).

Is the work to be done relatively easy to explain? The hooks in MVC 6 should be much cleaner than before, I recall a brief exchange with you a few months back happened exactly at the moment Microsoft finally responded to one of your ASP.NET MVC github issues on the subject of Fluent's integration with MVC6, you were very hopeful following that.

What can I do to help?

ddotlic commented Sep 20, 2015

@JeremySkinner I might have some time to do this at work (win-win for everyone) since my employer needs this (we're starting our work on next major version of the product and we'll be depending on Fluent Validation).

Is the work to be done relatively easy to explain? The hooks in MVC 6 should be much cleaner than before, I recall a brief exchange with you a few months back happened exactly at the moment Microsoft finally responded to one of your ASP.NET MVC github issues on the subject of Fluent's integration with MVC6, you were very hopeful following that.

What can I do to help?

@JeremySkinner

This comment has been minimized.

Show comment
Hide comment
@JeremySkinner

JeremySkinner Sep 21, 2015

Owner

Thanks, I appreciate the offer. At the moment there's not much more that can be done...I'm still waiting for the asp.net team to make the following changes:

  • Support for localization satellite assemblies in vnext projects
  • Changes to the validation API to make it easier to add 3rd party validation libraries

Once these are done then I can do the following:

  • Start using the vnext project file to generate outputs for all supported frameworks (rather than having separate projects for .net, vnext, pcl etc). I've done most of the work for this already, I just need to re-enable it
  • Add the MVC integration project. This is where most of the work will be - I haven't started on it at all because the API is still in flux. I don't quite know what it'll look like yet until I see the final validation API in MVC, but it should be quite different to the existing integration projects.

I'll post an update here when I know more about what'll be needed.

Owner

JeremySkinner commented Sep 21, 2015

Thanks, I appreciate the offer. At the moment there's not much more that can be done...I'm still waiting for the asp.net team to make the following changes:

  • Support for localization satellite assemblies in vnext projects
  • Changes to the validation API to make it easier to add 3rd party validation libraries

Once these are done then I can do the following:

  • Start using the vnext project file to generate outputs for all supported frameworks (rather than having separate projects for .net, vnext, pcl etc). I've done most of the work for this already, I just need to re-enable it
  • Add the MVC integration project. This is where most of the work will be - I haven't started on it at all because the API is still in flux. I don't quite know what it'll look like yet until I see the final validation API in MVC, but it should be quite different to the existing integration projects.

I'll post an update here when I know more about what'll be needed.

@ddotlic

This comment has been minimized.

Show comment
Hide comment
@ddotlic

ddotlic Sep 21, 2015

Changes to the validation API to make it easier to add 3rd party validation libraries

I was under (did not check) impression they've done it based on your feedback? Still not done? Sigh. It's quite late to be adding these kind of modifications (they say they'll be feature complete in the next beta which is due in 2-3 weeks time).

Start using the vnext project file

Based on what I've seen elsewhere this is going to be a pain.

Add the MVC integration project. This is where most of the work will be - I haven't started on it at all because the API is still in flux.

Shame that the API still hasn't stabilized.

Oh well, let's revisit this subject a bit later 😄

ddotlic commented Sep 21, 2015

Changes to the validation API to make it easier to add 3rd party validation libraries

I was under (did not check) impression they've done it based on your feedback? Still not done? Sigh. It's quite late to be adding these kind of modifications (they say they'll be feature complete in the next beta which is due in 2-3 weeks time).

Start using the vnext project file

Based on what I've seen elsewhere this is going to be a pain.

Add the MVC integration project. This is where most of the work will be - I haven't started on it at all because the API is still in flux.

Shame that the API still hasn't stabilized.

Oh well, let's revisit this subject a bit later 😄

@ddotlic

This comment has been minimized.

Show comment
Hide comment
@ddotlic

ddotlic Sep 21, 2015

Just looking at our previous exchange - issue aspnet/Mvc#1260 is closed, with two other issues open of which one has already been closed leaving only one actually open: aspnet/Mvc#2303

I've seen you commented on this just last day and they seem to planning on tackling this thing this week.

Is the 2303 really the last thing that needs to be done?

I'm personally more weary of the trouble with NuGet 3 (targeting the dotnet "platform" in the package) than with this.

ddotlic commented Sep 21, 2015

Just looking at our previous exchange - issue aspnet/Mvc#1260 is closed, with two other issues open of which one has already been closed leaving only one actually open: aspnet/Mvc#2303

I've seen you commented on this just last day and they seem to planning on tackling this thing this week.

Is the 2303 really the last thing that needs to be done?

I'm personally more weary of the trouble with NuGet 3 (targeting the dotnet "platform" in the package) than with this.

@JeremySkinner

This comment has been minimized.

Show comment
Hide comment
@JeremySkinner

JeremySkinner Sep 21, 2015

Owner

Yes, I think 2303 is the last mvc issue I need changed. I'm also waiting for satellite assembly support which should also be coming with beta 8.

Owner

JeremySkinner commented Sep 21, 2015

Yes, I think 2303 is the last mvc issue I need changed. I'm also waiting for satellite assembly support which should also be coming with beta 8.

@ddotlic

This comment has been minimized.

Show comment
Hide comment
@ddotlic

ddotlic Sep 21, 2015

OK, good to know. Let's hope beta8 comes as planned and without any further delays. Cheers!

ddotlic commented Sep 21, 2015

OK, good to know. Let's hope beta8 comes as planned and without any further delays. Cheers!

@JeremySkinner

This comment has been minimized.

Show comment
Hide comment
@JeremySkinner

JeremySkinner Oct 19, 2015

Owner

So beta8 is now out - I've updated the core project to build against beta8, and I'm pleased to say that localization support is now in.

I haven't started on the mvc6 project yet, so if you still have some time to help out then that would be great!

Owner

JeremySkinner commented Oct 19, 2015

So beta8 is now out - I've updated the core project to build against beta8, and I'm pleased to say that localization support is now in.

I haven't started on the mvc6 project yet, so if you still have some time to help out then that would be great!

@ddotlic

This comment has been minimized.

Show comment
Hide comment
@ddotlic

ddotlic Oct 19, 2015

We're just now working on integrating beta8 bits too at my employer's. In a few days I'll be free to work on whatever comes next. I do need to see with my employer because in my "personal" time there's very little free (transitioning from full time to consulting but already working on consulting and a 3yo at home...). Maybe we could already see how to split the work best? While I have extensive experience with coding in general and .NET in particular, I do not know your code base and might need a bit of time to adapt - is there anything sufficiently isolated for me to work on?

ddotlic commented Oct 19, 2015

We're just now working on integrating beta8 bits too at my employer's. In a few days I'll be free to work on whatever comes next. I do need to see with my employer because in my "personal" time there's very little free (transitioning from full time to consulting but already working on consulting and a 3yo at home...). Maybe we could already see how to split the work best? While I have extensive experience with coding in general and .NET in particular, I do not know your code base and might need a bit of time to adapt - is there anything sufficiently isolated for me to work on?

@JeremySkinner

This comment has been minimized.

Show comment
Hide comment
@JeremySkinner

JeremySkinner Oct 19, 2015

Owner

So the thing I'd particularly like help with is stubbing out what the new FluentValidationModelValidatorProvider should look like - if that's something that you happen to get a chance to look into it'd be very much appreciated. I haven't had a chance to look at the API since aspnet/Mvc#2303 and aspnet/Mvc#2304 have been implemented.

I don't think this should particularly require any in-depth knowledge of FV's codebase - the only thing to remember is the major difference between FV and DataAnnotations, where FV needs to run after all properties have been set, whilst the DataAnnotations provider validates each value before the property is set.

Owner

JeremySkinner commented Oct 19, 2015

So the thing I'd particularly like help with is stubbing out what the new FluentValidationModelValidatorProvider should look like - if that's something that you happen to get a chance to look into it'd be very much appreciated. I haven't had a chance to look at the API since aspnet/Mvc#2303 and aspnet/Mvc#2304 have been implemented.

I don't think this should particularly require any in-depth knowledge of FV's codebase - the only thing to remember is the major difference between FV and DataAnnotations, where FV needs to run after all properties have been set, whilst the DataAnnotations provider validates each value before the property is set.

@ddotlic

This comment has been minimized.

Show comment
Hide comment
@ddotlic

ddotlic Oct 19, 2015

I did not know that about DataAnnotations but yet another reason not to use them ;)

I'll leave myself a reminder to look into FluentValidationModelValidatorProvider

ddotlic commented Oct 19, 2015

I did not know that about DataAnnotations but yet another reason not to use them ;)

I'll leave myself a reminder to look into FluentValidationModelValidatorProvider

@jln1989

This comment has been minimized.

Show comment
Hide comment
@jln1989

jln1989 Oct 28, 2015

@JeremySkinner @ddotlic : Is Satellite assembly support is available now as Beta8 is released? I did not find any information regarding the same.

jln1989 commented Oct 28, 2015

@JeremySkinner @ddotlic : Is Satellite assembly support is available now as Beta8 is released? I did not find any information regarding the same.

@JeremySkinner

This comment has been minimized.

Show comment
Hide comment
@JeremySkinner

JeremySkinner Oct 28, 2015

Owner

Yes, it is.

On Wednesday, 28 October 2015, jln1989 notifications@github.com wrote:

@JeremySkinner https://github.com/JeremySkinner @ddotlic
https://github.com/ddotlic : Is Satellite assembly support is available
now as Beta8 is released? I did not find any information regarding the same.


Reply to this email directly or view it on GitHub
#98 (comment)
.

Owner

JeremySkinner commented Oct 28, 2015

Yes, it is.

On Wednesday, 28 October 2015, jln1989 notifications@github.com wrote:

@JeremySkinner https://github.com/JeremySkinner @ddotlic
https://github.com/ddotlic : Is Satellite assembly support is available
now as Beta8 is released? I did not find any information regarding the same.


Reply to this email directly or view it on GitHub
#98 (comment)
.

@ddotlic

This comment has been minimized.

Show comment
Hide comment
@ddotlic

ddotlic Oct 28, 2015

@JeremySkinner My employer works in 2 week sprints, we end this sprint in 2 days, I'll try to put in some planned time for fluent validation for next sprint and then look into what you've asked me to.
I'll take a look at the overall structure of the project (from the inside) in the meantime on my own time.

ddotlic commented Oct 28, 2015

@JeremySkinner My employer works in 2 week sprints, we end this sprint in 2 days, I'll try to put in some planned time for fluent validation for next sprint and then look into what you've asked me to.
I'll take a look at the overall structure of the project (from the inside) in the meantime on my own time.

@jln1989

This comment has been minimized.

Show comment
Hide comment
@jln1989

jln1989 Oct 28, 2015

@JeremySkinner : Can you point to any info regarding the same as it would be really helpful to me?

jln1989 commented Oct 28, 2015

@JeremySkinner : Can you point to any info regarding the same as it would be really helpful to me?

@JeremySkinner

This comment has been minimized.

Show comment
Hide comment
@JeremySkinner

JeremySkinner Oct 28, 2015

Owner

It just works out of the box...if you have resource files in your project then satellite assemblies are generated at build time.

Owner

JeremySkinner commented Oct 28, 2015

It just works out of the box...if you have resource files in your project then satellite assemblies are generated at build time.

@JeremySkinner

This comment has been minimized.

Show comment
Hide comment
@JeremySkinner

JeremySkinner Oct 28, 2015

Owner

@ddotlic, thanks, I appreciate it

Owner

JeremySkinner commented Oct 28, 2015

@ddotlic, thanks, I appreciate it

@ddotlic

This comment has been minimized.

Show comment
Hide comment
@ddotlic

ddotlic Nov 4, 2015

I managed to secure some time for Fluent this sprint, but it's not clear yet how much. Unfortunately, companies are much more eager to use OSS work than to contribute to it. I'll keep fighting though 😉

ddotlic commented Nov 4, 2015

I managed to secure some time for Fluent this sprint, but it's not clear yet how much. Unfortunately, companies are much more eager to use OSS work than to contribute to it. I'll keep fighting though 😉

@janhartmann

This comment has been minimized.

Show comment
Hide comment
@janhartmann

janhartmann Jan 9, 2016

What is the status on this? I might can help out as well.

Been a fan of FV for years and recently starting using .NET MVC 6, so I am looking forward to this is out. Let me know whats the status is and I would sure help out where I can.

janhartmann commented Jan 9, 2016

What is the status on this? I might can help out as well.

Been a fan of FV for years and recently starting using .NET MVC 6, so I am looking forward to this is out. Let me know whats the status is and I would sure help out where I can.

@ddotlic

This comment has been minimized.

Show comment
Hide comment
@ddotlic

ddotlic Jan 10, 2016

@janhartmann As usual, life happened (at least for me). Prior to today, had no personal time and my employer (which just became my client as I've gone independent) had other things to work on.

Just came back from vacation and if we're lucky, my client will have me work on validation aspects of the solution in question which should mean some time "free" to work on this.

Like @JeremySkinner due to my consulting obligations, I won't have time outside the normal working hours (already booked 120%, 😫) but it's definitely time we get the ball rolling as ASP.NET 5 is in RC1 phase and things should be pretty stable by now (though based on my experience so far it's really not, Microsoft is still changing small things, enough to irritate us 😉 )

ddotlic commented Jan 10, 2016

@janhartmann As usual, life happened (at least for me). Prior to today, had no personal time and my employer (which just became my client as I've gone independent) had other things to work on.

Just came back from vacation and if we're lucky, my client will have me work on validation aspects of the solution in question which should mean some time "free" to work on this.

Like @JeremySkinner due to my consulting obligations, I won't have time outside the normal working hours (already booked 120%, 😫) but it's definitely time we get the ball rolling as ASP.NET 5 is in RC1 phase and things should be pretty stable by now (though based on my experience so far it's really not, Microsoft is still changing small things, enough to irritate us 😉 )

@SvenVandenbrande

This comment has been minimized.

Show comment
Hide comment
@SvenVandenbrande

SvenVandenbrande Jan 11, 2016

Let's hope you both have some time in the coming weeks to accomplish this. :)
cc: @janhartmann , @JeremySkinner , @ddotlic

Always available for testing. :)

SvenVandenbrande commented Jan 11, 2016

Let's hope you both have some time in the coming weeks to accomplish this. :)
cc: @janhartmann , @JeremySkinner , @ddotlic

Always available for testing. :)

@JeremySkinner

This comment has been minimized.

Show comment
Hide comment
@JeremySkinner

JeremySkinner Jan 12, 2016

Owner

Sorry I've not had any time to work on this at all recently.

Some things I'm thinking about though:
I'm incredibly uncomfortable with using the "FluentValidation-vnext" project that's currently in the repo. My initial plan was to use this one project to produce multiple outputs targeting different platforms, which would help keep the project clean (ie only 1 codebase, rather than having several different projects/PCLs like at the moment.

Unfortunately I've not had much luck with this due to the constant changes being made to the project.json format, and also the incredibly vague and unhelpful build errors that make problems incredibly difficult to track down.

So instead I'm planning on keeping the solution in a similar format to it is now, with separate projects producing explicit outputs:

FluentValidation: The old core project will essentially remain as-is targetting 4.5
FluentValidation.Portable: This will be expanded to target ASP.NET Core 5
FluentValidation.Portable40: This will stay as-is, and is essentially deprecated now that MS no longer support .NET 4.0
FluentValidation.MVC5: Stay as-is
FluentValidation.MVC6: New PCL to target ASP.NET Core 5
FluentValidation.Win10: New PCL to target universal Win10

This shouldn't require too much work, as code changes for all this have already been done.

I haven't even begun on the MVC6 integration since beta8 was released. This is where the bulk of the work will be, and is still a long way off. I don't personally have any MVC6 projects in the pipeline (or in fact, any projects that use FV), which makes it very hard to find time to work on MVC6 FV integration. I can sometimes spend 1-2 hours per week on FV, at most.

Owner

JeremySkinner commented Jan 12, 2016

Sorry I've not had any time to work on this at all recently.

Some things I'm thinking about though:
I'm incredibly uncomfortable with using the "FluentValidation-vnext" project that's currently in the repo. My initial plan was to use this one project to produce multiple outputs targeting different platforms, which would help keep the project clean (ie only 1 codebase, rather than having several different projects/PCLs like at the moment.

Unfortunately I've not had much luck with this due to the constant changes being made to the project.json format, and also the incredibly vague and unhelpful build errors that make problems incredibly difficult to track down.

So instead I'm planning on keeping the solution in a similar format to it is now, with separate projects producing explicit outputs:

FluentValidation: The old core project will essentially remain as-is targetting 4.5
FluentValidation.Portable: This will be expanded to target ASP.NET Core 5
FluentValidation.Portable40: This will stay as-is, and is essentially deprecated now that MS no longer support .NET 4.0
FluentValidation.MVC5: Stay as-is
FluentValidation.MVC6: New PCL to target ASP.NET Core 5
FluentValidation.Win10: New PCL to target universal Win10

This shouldn't require too much work, as code changes for all this have already been done.

I haven't even begun on the MVC6 integration since beta8 was released. This is where the bulk of the work will be, and is still a long way off. I don't personally have any MVC6 projects in the pipeline (or in fact, any projects that use FV), which makes it very hard to find time to work on MVC6 FV integration. I can sometimes spend 1-2 hours per week on FV, at most.

@SvenVandenbrande

This comment has been minimized.

Show comment
Hide comment
@SvenVandenbrande

SvenVandenbrande Jan 12, 2016

I have some application that i am writing for the moment in ASP.NET 5 MVC 6, so no problem to test it..

SvenVandenbrande commented Jan 12, 2016

I have some application that i am writing for the moment in ASP.NET 5 MVC 6, so no problem to test it..

@ddotlic

This comment has been minimized.

Show comment
Hide comment
@ddotlic

ddotlic Jan 12, 2016

So instead I'm planning on keeping the solution in a similar format to it is now, with separate projects producing explicit outputs:

I am affraid that this is the only sensible course of action, however silly it might seem.

I agree with you 110% that Microsoft's message, thinking and recent attempts at specifying how to package code in the new world are nothing but confusing.

I don't personally have any MVC6 projects in the pipeline

My ex-employer (now client) actually does, so we're in a very good position to test the integration on a real-life codebase.

I've recently integrated several aspects of a typical Web site into the code and MVC6 has been really, really great. There is the issue of extremely sparse documentation (for now) and API changes even in this phase, but overall I've enjoyed every step of the way.

Differently put, I have high hopes that FV will - this time - integrate in a much easier way than before.

ddotlic commented Jan 12, 2016

So instead I'm planning on keeping the solution in a similar format to it is now, with separate projects producing explicit outputs:

I am affraid that this is the only sensible course of action, however silly it might seem.

I agree with you 110% that Microsoft's message, thinking and recent attempts at specifying how to package code in the new world are nothing but confusing.

I don't personally have any MVC6 projects in the pipeline

My ex-employer (now client) actually does, so we're in a very good position to test the integration on a real-life codebase.

I've recently integrated several aspects of a typical Web site into the code and MVC6 has been really, really great. There is the issue of extremely sparse documentation (for now) and API changes even in this phase, but overall I've enjoyed every step of the way.

Differently put, I have high hopes that FV will - this time - integrate in a much easier way than before.

@janhartmann

This comment has been minimized.

Show comment
Hide comment
@janhartmann

janhartmann Jan 12, 2016

I have some almost-live-projects on mvc6 which I can test with as well.

janhartmann commented Jan 12, 2016

I have some almost-live-projects on mvc6 which I can test with as well.

@JeremySkinner

This comment has been minimized.

Show comment
Hide comment
@JeremySkinner

JeremySkinner Jan 13, 2016

Owner

Quick update on this:

  • I've now moved the solution entirely over to VS2015
  • I've added a FluentValidation.Portable46 project.

The Portable46 project is one of the new format PCL projects (only available in VS2015) and targets .NET 4.6, Universal Win10 and ASP.NET Core 5.0

Unfortunately, there's a CLR bug in RC1 that prevents referencing aspnet5 class libraries from the new format PCLs. This is supposedly due to be fixed in RC2: dotnet/coreclr#1964

The result of this is that I can't actually reference the MVC6 dlls at the moment, which makes writing the MVC integration rather difficult!

So I guess the MVC integration is on hold until RC2 is released.

Owner

JeremySkinner commented Jan 13, 2016

Quick update on this:

  • I've now moved the solution entirely over to VS2015
  • I've added a FluentValidation.Portable46 project.

The Portable46 project is one of the new format PCL projects (only available in VS2015) and targets .NET 4.6, Universal Win10 and ASP.NET Core 5.0

Unfortunately, there's a CLR bug in RC1 that prevents referencing aspnet5 class libraries from the new format PCLs. This is supposedly due to be fixed in RC2: dotnet/coreclr#1964

The result of this is that I can't actually reference the MVC6 dlls at the moment, which makes writing the MVC integration rather difficult!

So I guess the MVC integration is on hold until RC2 is released.

@janhartmann

This comment has been minimized.

Show comment
Hide comment
@janhartmann

janhartmann Jan 14, 2016

Thanks for the update - looking forward to RC2! 👍

janhartmann commented Jan 14, 2016

Thanks for the update - looking forward to RC2! 👍

@JeremySkinner

This comment has been minimized.

Show comment
Hide comment
@JeremySkinner

JeremySkinner Jun 28, 2016

Owner

Good morning,

I've just pushed out FV 6.4 Beta 1 with support for .NET core 1.0 and ASP.NET Core. A few notes:

  • All dependencies should now be up to date with net core 1.0. Let me know if you find any I've missed.
  • The MVC integration is in the package "FluentValidation.AspNetCore" for consistency with Microsoft's naming convention
  • The FluentValidation.MVC6 package is just an alias for FluentValidation.AspNetCore.

Please give these packages a try and if you find any problems please open a new issue rather than commenting on this one.

A massive thankyou to everyone who contributed time to making this work.

Ps, If anyone wants to help with the documentation, please let me know ;)

Owner

JeremySkinner commented Jun 28, 2016

Good morning,

I've just pushed out FV 6.4 Beta 1 with support for .NET core 1.0 and ASP.NET Core. A few notes:

  • All dependencies should now be up to date with net core 1.0. Let me know if you find any I've missed.
  • The MVC integration is in the package "FluentValidation.AspNetCore" for consistency with Microsoft's naming convention
  • The FluentValidation.MVC6 package is just an alias for FluentValidation.AspNetCore.

Please give these packages a try and if you find any problems please open a new issue rather than commenting on this one.

A massive thankyou to everyone who contributed time to making this work.

Ps, If anyone wants to help with the documentation, please let me know ;)

@jeremymeng

This comment has been minimized.

Show comment
Hide comment
@jeremymeng

jeremymeng Jun 28, 2016

Contributor

Are you also also expecting the need to wrap the Netstandard PCL to disappear?

At the moment not yet as far as I know.

Contributor

jeremymeng commented Jun 28, 2016

Are you also also expecting the need to wrap the Netstandard PCL to disappear?

At the moment not yet as far as I know.

@lruckman

This comment has been minimized.

Show comment
Hide comment
@lruckman

lruckman Jul 3, 2016

The FluentValidation.AspNetCore package doesn't seem to like .NET Core Web Applications using net461.

Package FluentValidation.AspNetCore 6.4.0-beta2 is not compatible with net461 (.NETFramework,Version=v4.6.1). Package FluentValidation.AspNetCore 6.4.0-beta2 supports: netstandard1.6 (.NETStandard,Version=v1.6)
One or more packages are incompatible with .NETFramework,Version=v4.6.1.

lruckman commented Jul 3, 2016

The FluentValidation.AspNetCore package doesn't seem to like .NET Core Web Applications using net461.

Package FluentValidation.AspNetCore 6.4.0-beta2 is not compatible with net461 (.NETFramework,Version=v4.6.1). Package FluentValidation.AspNetCore 6.4.0-beta2 supports: netstandard1.6 (.NETStandard,Version=v1.6)
One or more packages are incompatible with .NETFramework,Version=v4.6.1.

@JeremySkinner

This comment has been minimized.

Show comment
Hide comment
@JeremySkinner

JeremySkinner Jul 4, 2016

Owner

I'll get that fixed

Owner

JeremySkinner commented Jul 4, 2016

I'll get that fixed

@JeremySkinner

This comment has been minimized.

Show comment
Hide comment
@JeremySkinner

JeremySkinner Jul 4, 2016

Owner

I've pushed out a beta3 package- please give it another try.

Owner

JeremySkinner commented Jul 4, 2016

I've pushed out a beta3 package- please give it another try.

@JeremySkinner

This comment has been minimized.

Show comment
Hide comment
@JeremySkinner

JeremySkinner Jul 4, 2016

Owner

@jeremymeng I'm seeing an issue with universal windows apps having versioning problems. Could this be related to the specific dependencies we added into the FluentValidation.nuspec? These are the kind of errors I'm seeing on an install-package fluentvalidation:

Detected package downgrade: System.Runtime.WindowsRuntime from 4.0.11 to 4.0.10 App2 (>= 1.0.0) -> Microsoft.NETCore.UniversalWindowsPlatform (>= 5.1.0) -> Microsoft.NETCore (>= 5.0.0) -> System.IO.FileSystem (>= 4.0.0) -> runtime.win.System.IO.FileSystem (>= 4.0.1) -> System.Runtime.WindowsRuntime (>= 4.0.11) App2 (>= 1.0.0) -> Microsoft.NETCore.UniversalWindowsPlatform (>= 5.1.0) -> System.Runtime.WindowsRuntime (>= 4.0.10)
...etc

System.Reflection.Emit.ILGeneration 4.0.1 provides a compile-time reference assembly for System.Reflection.Emit.ILGeneration on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-arm-aot.

Is that something you've seen before?

Edit: I think this is actually caused by the default uap project template, rather than anything in FV.

Owner

JeremySkinner commented Jul 4, 2016

@jeremymeng I'm seeing an issue with universal windows apps having versioning problems. Could this be related to the specific dependencies we added into the FluentValidation.nuspec? These are the kind of errors I'm seeing on an install-package fluentvalidation:

Detected package downgrade: System.Runtime.WindowsRuntime from 4.0.11 to 4.0.10 App2 (>= 1.0.0) -> Microsoft.NETCore.UniversalWindowsPlatform (>= 5.1.0) -> Microsoft.NETCore (>= 5.0.0) -> System.IO.FileSystem (>= 4.0.0) -> runtime.win.System.IO.FileSystem (>= 4.0.1) -> System.Runtime.WindowsRuntime (>= 4.0.11) App2 (>= 1.0.0) -> Microsoft.NETCore.UniversalWindowsPlatform (>= 5.1.0) -> System.Runtime.WindowsRuntime (>= 4.0.10)
...etc

System.Reflection.Emit.ILGeneration 4.0.1 provides a compile-time reference assembly for System.Reflection.Emit.ILGeneration on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-arm-aot.

Is that something you've seen before?

Edit: I think this is actually caused by the default uap project template, rather than anything in FV.

@lruckman

This comment has been minimized.

Show comment
Hide comment
@lruckman

lruckman Jul 4, 2016

@JeremySkinner that works, thanks a bunch!

lruckman commented Jul 4, 2016

@JeremySkinner that works, thanks a bunch!

@jeremymeng

This comment has been minimized.

Show comment
Hide comment
@jeremymeng

jeremymeng Jul 5, 2016

Contributor

I'm seeing an issue with universal windows apps having versioning problems. Could this be related to the specific dependencies we added into the FluentValidation.nuspec?

I think for UAP, NET Core platform 5.2.0 is needed to consume the new .NET Core bits. I used NuSpec.ReferenceGenerator to update the dependencies in the nuspec file, which automatically uses the compatible (same major and minor, higher revision) versions. I tested and verified that beta3 package works with "Microsoft.NETCore.UniversalWindowsPlatform": "5.2.0".

Since we are using the portable binaries for profile259 and uap10.0, it might be better to use the original dependency versions. I submitted #294. It worked with "Microsoft.NETCore.UniversalWindowsPlatform": "5.1.0" in my local testing.

Contributor

jeremymeng commented Jul 5, 2016

I'm seeing an issue with universal windows apps having versioning problems. Could this be related to the specific dependencies we added into the FluentValidation.nuspec?

I think for UAP, NET Core platform 5.2.0 is needed to consume the new .NET Core bits. I used NuSpec.ReferenceGenerator to update the dependencies in the nuspec file, which automatically uses the compatible (same major and minor, higher revision) versions. I tested and verified that beta3 package works with "Microsoft.NETCore.UniversalWindowsPlatform": "5.2.0".

Since we are using the portable binaries for profile259 and uap10.0, it might be better to use the original dependency versions. I submitted #294. It worked with "Microsoft.NETCore.UniversalWindowsPlatform": "5.1.0" in my local testing.

@JeremySkinner

This comment has been minimized.

Show comment
Hide comment
@JeremySkinner

JeremySkinner Jul 6, 2016

Owner

Thanks, I'll try and get this merged in this week.

Owner

JeremySkinner commented Jul 6, 2016

Thanks, I'll try and get this merged in this week.

@JeremySkinner

This comment has been minimized.

Show comment
Hide comment
@JeremySkinner

JeremySkinner Jul 8, 2016

Owner

That's done- thanks.

Owner

JeremySkinner commented Jul 8, 2016

That's done- thanks.

@arielcloud

This comment has been minimized.

Show comment
Hide comment
@arielcloud

arielcloud Jul 26, 2016

Where can I found any example or docs about injecting validators in asp.net built-in DI?
I saw this, but is for structureMap. thanks!

arielcloud commented Jul 26, 2016

Where can I found any example or docs about injecting validators in asp.net built-in DI?
I saw this, but is for structureMap. thanks!

@JeremySkinner

This comment has been minimized.

Show comment
Hide comment
@JeremySkinner

JeremySkinner Jul 27, 2016

Owner

@arielcloud https://docs.asp.net/en/latest/fundamentals/dependency-injection.html

The principle is exactly the same- just register with the built-in container instead of SM.

Owner

JeremySkinner commented Jul 27, 2016

@arielcloud https://docs.asp.net/en/latest/fundamentals/dependency-injection.html

The principle is exactly the same- just register with the built-in container instead of SM.

@arielcloud

This comment has been minimized.

Show comment
Hide comment
@arielcloud

arielcloud Jul 27, 2016

I not see any "TryResolve" or "TryGetInstance" in https://docs.asp.net/en/latest/fundamentals/dependency-injection.html
so, how can I create the "ValidatorFactory". if you can give more details - it will be great.

for my services I just create an interface, and inject it to the DI by for example: services.AddTransient<IModelValidation, ModelValidation>();

but with fluent validation I don't understand how to use it.

arielcloud commented Jul 27, 2016

I not see any "TryResolve" or "TryGetInstance" in https://docs.asp.net/en/latest/fundamentals/dependency-injection.html
so, how can I create the "ValidatorFactory". if you can give more details - it will be great.

for my services I just create an interface, and inject it to the DI by for example: services.AddTransient<IModelValidation, ModelValidation>();

but with fluent validation I don't understand how to use it.

@JeremySkinner

This comment has been minimized.

Show comment
Hide comment
@JeremySkinner

JeremySkinner Jul 27, 2016

Owner

I'm not sure I understand what you're asking.

You register your validators with the container in the same way as you described:

services.AddSingleton<IValidator<Person>, PersonValidator>();

You don't need to write a validator factory. The default one will handle resolution from the container.

Just make sure you've called the AddFluentValidation extension method:

services.AddMvc().AddFluentValidation()

...and this sets up all the configuration necessary to use the default container with FV.

Owner

JeremySkinner commented Jul 27, 2016

I'm not sure I understand what you're asking.

You register your validators with the container in the same way as you described:

services.AddSingleton<IValidator<Person>, PersonValidator>();

You don't need to write a validator factory. The default one will handle resolution from the container.

Just make sure you've called the AddFluentValidation extension method:

services.AddMvc().AddFluentValidation()

...and this sets up all the configuration necessary to use the default container with FV.

@hmvs

This comment has been minimized.

Show comment
Hide comment
@hmvs

hmvs Jul 27, 2016

Would be nice to have extension for IMvcCoreBuilder
to have ability to call services.AddMvcCore().AddFluentValidation()

hmvs commented Jul 27, 2016

Would be nice to have extension for IMvcCoreBuilder
to have ability to call services.AddMvcCore().AddFluentValidation()

@JeremySkinner

This comment has been minimized.

Show comment
Hide comment
@JeremySkinner

JeremySkinner Jul 27, 2016

Owner

I'll see about getting that added....I didn't even know there was an AddMvcCore! Seems quite confusing to have 2 entry points for configuration

Owner

JeremySkinner commented Jul 27, 2016

I'll see about getting that added....I didn't even know there was an AddMvcCore! Seems quite confusing to have 2 entry points for configuration

@arielcloud

This comment has been minimized.

Show comment
Hide comment
@arielcloud

arielcloud Jul 27, 2016

I got

'IMvcBuilder' does not contain a definition for 'AddFluentValidation' and no extension method 'AddFluentValidation' accepting a first argument of type 'IMvcBuilder' could be found (are you missing a using directive or an assembly reference?)

I dont missed using FluentValidation; in my startup.cs file, and I have "FluentValidation": "6.4.0-beta3"

arielcloud commented Jul 27, 2016

I got

'IMvcBuilder' does not contain a definition for 'AddFluentValidation' and no extension method 'AddFluentValidation' accepting a first argument of type 'IMvcBuilder' could be found (are you missing a using directive or an assembly reference?)

I dont missed using FluentValidation; in my startup.cs file, and I have "FluentValidation": "6.4.0-beta3"

@JeremySkinner

This comment has been minimized.

Show comment
Hide comment
@JeremySkinner

JeremySkinner Jul 27, 2016

Owner

You need to have installed the FluentValidation.AspNetCore package and have a using FluentValidation.AspNetCore.

Owner

JeremySkinner commented Jul 27, 2016

You need to have installed the FluentValidation.AspNetCore package and have a using FluentValidation.AspNetCore.

@gdoron

This comment has been minimized.

Show comment
Hide comment
@gdoron

gdoron Jul 27, 2016

Regarding AddMvcCore:

aspnet/Mvc#2872

gdoron commented Jul 27, 2016

Regarding AddMvcCore:

aspnet/Mvc#2872

@hmvs

This comment has been minimized.

Show comment
Hide comment
@hmvs

hmvs Jul 28, 2016

@JeremySkinner saw that you committed AddFluentValidation for the IMvcCoreBuilder. Thanks for that :) Would be nice to have it in nuget.

hmvs commented Jul 28, 2016

@JeremySkinner saw that you committed AddFluentValidation for the IMvcCoreBuilder. Thanks for that :) Would be nice to have it in nuget.

@rono1

This comment has been minimized.

Show comment
Hide comment
@rono1

rono1 Sep 20, 2016

I noticed this is still listed as prerelease in nuget. Is this basically stable enough to use in production, or are there still pending issues?

rono1 commented Sep 20, 2016

I noticed this is still listed as prerelease in nuget. Is this basically stable enough to use in production, or are there still pending issues?

@CumpsD

This comment has been minimized.

Show comment
Hide comment
@CumpsD

CumpsD Sep 26, 2016

Just trying to summarize here, to see what should be working at this stage, please correct me where I'm missing something:

  • Latest version: "FluentValidation.AspNetCore": "6.4.0-beta3"

In Startup the only change needed is:

services
    .AddMvc()
    .AddFluentValidation(fv => fv.RegisterValidatorsFromAssemblyContaining<Startup>());

Types are decorated with Validator

[Validator(typeof(CreateLocationRequestValidator))]
public class CreateLocationRequest
{
    public int? ExternalId { get; set; }

    public Address Address { get; set; }
}

Validators are made with AbstractValidator<T>

public class CreateLocationRequestValidator : AbstractValidator<CreateLocationRequest>
{
    public CreateLocationRequestValidator()
    {
        RuleFor(x => x.ExternalId)
            .NotEmpty()
            .When(IsAddressEmpty)
            .WithMessage("ExternalId or Address is required.");

        RuleFor(x => x.Address)
            .NotEmpty()
            .When(x => !x.ExternalId.HasValue)
            .WithMessage("ExternalId or Address is required.");
    }

After doing all of the above, this should work?

        [HttpPost]
        public ActionResult Post([FromBody] CreateLocationRequest message)
        {
            if (!ModelState.IsValid)
                return BadRequest();

            return Ok();
        }

I think I'm missing something, since my validator isn't being hit in debug ;) But what am I missing exactly?

Edit:
No idea what went wrong, but the above actually works, perhaps I had some old compiled files left behind.

CumpsD commented Sep 26, 2016

Just trying to summarize here, to see what should be working at this stage, please correct me where I'm missing something:

  • Latest version: "FluentValidation.AspNetCore": "6.4.0-beta3"

In Startup the only change needed is:

services
    .AddMvc()
    .AddFluentValidation(fv => fv.RegisterValidatorsFromAssemblyContaining<Startup>());

Types are decorated with Validator

[Validator(typeof(CreateLocationRequestValidator))]
public class CreateLocationRequest
{
    public int? ExternalId { get; set; }

    public Address Address { get; set; }
}

Validators are made with AbstractValidator<T>

public class CreateLocationRequestValidator : AbstractValidator<CreateLocationRequest>
{
    public CreateLocationRequestValidator()
    {
        RuleFor(x => x.ExternalId)
            .NotEmpty()
            .When(IsAddressEmpty)
            .WithMessage("ExternalId or Address is required.");

        RuleFor(x => x.Address)
            .NotEmpty()
            .When(x => !x.ExternalId.HasValue)
            .WithMessage("ExternalId or Address is required.");
    }

After doing all of the above, this should work?

        [HttpPost]
        public ActionResult Post([FromBody] CreateLocationRequest message)
        {
            if (!ModelState.IsValid)
                return BadRequest();

            return Ok();
        }

I think I'm missing something, since my validator isn't being hit in debug ;) But what am I missing exactly?

Edit:
No idea what went wrong, but the above actually works, perhaps I had some old compiled files left behind.

@JeremySkinner

This comment has been minimized.

Show comment
Hide comment
@JeremySkinner

JeremySkinner Sep 27, 2016

Owner

@CumpsD

Calling RegisterValidatorsFromAssemblyContaining... registers the validators with MVC's built-in IoC container, meaning you should remove the ValidatorAttribute from your validators. The ValidatorAttribute is for use with the AttributedValidatorFactory, which was the default way of instantating validators in older versions of MVC. You can still use this if you want, but you'd need to set this up explicitly in your AddFluentValidation call.

If you run into further problems, please open a separate issue. Thanks!

Owner

JeremySkinner commented Sep 27, 2016

@CumpsD

Calling RegisterValidatorsFromAssemblyContaining... registers the validators with MVC's built-in IoC container, meaning you should remove the ValidatorAttribute from your validators. The ValidatorAttribute is for use with the AttributedValidatorFactory, which was the default way of instantating validators in older versions of MVC. You can still use this if you want, but you'd need to set this up explicitly in your AddFluentValidation call.

If you run into further problems, please open a separate issue. Thanks!

@CumpsD

This comment has been minimized.

Show comment
Hide comment
@CumpsD

CumpsD Sep 27, 2016

Thanks for the clarification 👍

CumpsD commented Sep 27, 2016

Thanks for the clarification 👍

@JeremySkinner

This comment has been minimized.

Show comment
Hide comment
@JeremySkinner

JeremySkinner Jan 28, 2017

Owner

For those still following the progress on this, I'm hoping to have support for clientside validation on asp.net core done by next week, with an updated beta package shortly after.

Owner

JeremySkinner commented Jan 28, 2017

For those still following the progress on this, I'm hoping to have support for clientside validation on asp.net core done by next week, with an updated beta package shortly after.

@JeremySkinner

This comment has been minimized.

Show comment
Hide comment
@JeremySkinner

JeremySkinner Jan 30, 2017

Owner

6.4 rc1 is out with clientside support. Please give it a try. If this all looks good then this is the build that'll go out as "stable".

Owner

JeremySkinner commented Jan 30, 2017

6.4 rc1 is out with clientside support. Please give it a try. If this all looks good then this is the build that'll go out as "stable".

@Usman235

This comment has been minimized.

Show comment
Hide comment
@Usman235

Usman235 Feb 3, 2017

@CumpsD i did the same thing which you mention above (Code) its working fine . let me explain my project structure first .
Project Structure

Above you can see the project structure of mine . if i put my following code in figure section-1(FH.Common) it not validating the model . but if i put my code in asp.net core web api (FH.Webapi) solution its working fine .

 [Validator(typeof(CurrencyDTOValidator))]
    public class CurrencyDTO
    {
        public int Id { get { return CurrencyId; } }
        public int CurrencyId { get; set; }
        public string Name { get; set; }
        public string Symbol { get; set; }

    }*/

    public class CurrencyDTOValidator : AbstractValidator<CurrencyDTO>
    {
        public CurrencyDTOValidator()
        {
            RuleFor(x => x.Name).NotEmpty().NotNull().WithMessage("The currency 'Name' is required.")
                                      .Length(0, 250).WithMessage("The currency 'Name' cannot be more than 250 characters.");

            RuleFor(x => x.Symbol).NotEmpty().WithMessage("The currency Symbol is required.");

            //RuleFor(x => x.BirthDate).LessThan(DateTime.Today).WithMessage("You cannot enter a birth date in the future.");
        
            //RuleFor(x => x.Username).Length(8, 999).WithMessage("The user name must be at least 8 characters long.");
        }
    }

Now may question is that is there any other thing i have to do to run it through class library i.e (FH.Common).

Note: FH.WebApi has a reference of Fh.Common

Usman235 commented Feb 3, 2017

@CumpsD i did the same thing which you mention above (Code) its working fine . let me explain my project structure first .
Project Structure

Above you can see the project structure of mine . if i put my following code in figure section-1(FH.Common) it not validating the model . but if i put my code in asp.net core web api (FH.Webapi) solution its working fine .

 [Validator(typeof(CurrencyDTOValidator))]
    public class CurrencyDTO
    {
        public int Id { get { return CurrencyId; } }
        public int CurrencyId { get; set; }
        public string Name { get; set; }
        public string Symbol { get; set; }

    }*/

    public class CurrencyDTOValidator : AbstractValidator<CurrencyDTO>
    {
        public CurrencyDTOValidator()
        {
            RuleFor(x => x.Name).NotEmpty().NotNull().WithMessage("The currency 'Name' is required.")
                                      .Length(0, 250).WithMessage("The currency 'Name' cannot be more than 250 characters.");

            RuleFor(x => x.Symbol).NotEmpty().WithMessage("The currency Symbol is required.");

            //RuleFor(x => x.BirthDate).LessThan(DateTime.Today).WithMessage("You cannot enter a birth date in the future.");
        
            //RuleFor(x => x.Username).Length(8, 999).WithMessage("The user name must be at least 8 characters long.");
        }
    }

Now may question is that is there any other thing i have to do to run it through class library i.e (FH.Common).

Note: FH.WebApi has a reference of Fh.Common

@JeremySkinner

This comment has been minimized.

Show comment
Hide comment
@JeremySkinner

JeremySkinner Mar 8, 2017

Owner

FV 6.4 is out with the final version of the aspnetcore integration. Thanks everyone for the help and feedback. If you run into any problems, please let me know on separate issues.

Owner

JeremySkinner commented Mar 8, 2017

FV 6.4 is out with the final version of the aspnetcore integration. Thanks everyone for the help and feedback. If you run into any problems, please let me know on separate issues.

@lock lock bot locked and limited conversation to collaborators Aug 21, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.