-
Notifications
You must be signed in to change notification settings - Fork 4k
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
EnforceCodeStyleInBuild does not cause the build to fail although errors are present #49439
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
I'm having this problem as well. The warning/error shows up in the Error List when it is set to |
I just tried again using VS 2019 Preview 2 and the |
+the |
I have noticed that these are no longer working for named rules such as:
but still work for rules using the analyzer ID such as:
I've created a more specific bug #52682 for this issue, though perhaps it's the same issue (I didn't see this one at first). |
Still happening on VS2022 |
I think I've figured out the missing ingredient here: the documented prescription to use a different syntax when setting diagnostic severity. By configuring my rules like this:
I'm seeing the results I expect. I don't know if I just didn't notice that documentation the last time I tried this or it didn't exist, but it seems to be working for me now. |
For me this Stackoverflow answer was the solution I needed. |
Just fixing this particular problem would go a long way to making the situation better |
Now I understand the available options a bit better, I guess this does make sense, but isn't necessarily intuitive... |
I have a similar issue if anyone could help. I've set EnforceCodeStyleInBuild to true.
I've also set an error severity in the .editorconfig for files with non-filescoped namespaces While editing in visual studio I can now see an error in any files that use blockscoped namespaces, which is what I want, however when I go to build and run the project it runs fine, even though it should fail as there's an error. |
@as3249762 Sounds like a separate issue, but maybe try IDE0160/IDE0161 instead/as well? If I understand correctly, the problem here was that the op also needed to set |
@jeremy-visionaid Thanks for getting back to me :) Adding IDE0160/IDE0161 kind of works. If in visual studio I try to rebuild I get a failed build, so it looks like rebuild is behaving as I would expect. If I subsequently try to build I also get a failed build. However it looks like build still isn't working as expected. If I
The build will be successful, even though it should be failing. Sorry if this should be put in a separate issue, this is my first time commenting on a github issue. |
Version Used:
Dotnet SDK 5.0.100
Visual Studio 2019 16.9.0 Preview 1
Steps to Reproduce:
dotnet build --configuration Release
Expected Behavior:
The build fails with the above error.
Actual Behavior:
The build succeeds.
The text was updated successfully, but these errors were encountered: