Building FluentValidation fails with CS0618 on CascadeMode.StopOnFirstFailure
See original GitHub issueFluentValidation version
source
ASP.NET version
No response
Summary
When I attempt to build from source using either the build.cmd or using Visual Studio I am getting:
Severity Code Description Project File Line Suppression State Error CS0618 'CascadeMode.StopOnFirstFailure' is obsolete: 'The behaviour of StopOnFirstFailure has been replaced by use of the separate validator-level properties ClassLevelCascadeMode and RuleLevelCascadeMode, and their global default equivalents. StopOnFirstFailure will be removed in a later release. For more details, see https://docs.fluentvalidation.net/en/latest/cascade.html .' FluentValidation (net5.0), FluentValidation (net6.0), FluentValidation (net7.0), FluentValidation (netstandard2.0), FluentValidation (netstandard2.1) C:\Users\kenne\source\repos\FluentValidation\src\FluentValidation\Enums.cs 39 Active
From examining the csproj file it doesn’t look like there is a property group explicitly setting TreatWarningsAsErrors or WarningsAsErrors but it appears to be defaulting to enabled in VS2022 (17.6.4) none the less. Not sure if it has always been this way, its a problem with just my machine or if there was a recent change to msbuild (I’m using 17.6.3+07e294721). In any case, I cannot build from source without either modifying the source or overriding the build properties.
This is my first attempt at building FluentValidation from source so it could just be some step I’m overlooking.
Steps to Reproduce
- Update Visual Studio 2022 to 17.6.4
- Do a fresh clone FluentValidation
- Attempt to run Build.cmd
- Attempt to build from Visual Studio
Issue Analytics
- State:
- Created 3 months ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top GitHub Comments
@Sivatronics That isn’t the correct solution. TreatWarningsAsErrors must remain enabled and suppressions should be placed in code where needed using #pragma, not disabled globally.
Hi,
TreatWarningsAsErrors
is enabled in src\Directory.build.props (not directly in the csproj files), to ensure it applies to all projects in the solution.That being said, I can’t reproduce this problem - all the places that use the deprecated enum should be wrapped in warning suppressions to prevent this. Running a
dotnet build
from the command line or from Rider doesn’t trigger an error. I can’t test with Visual Studio as I don’t use windows.Please check the following:
main
branch, and don’t have a different branch checked out.dotnet build
from the command line. Does the problem still occur?