I want to treat resharper 5.0 error "Possible NullReference Exception" as MSVS 2010 compile error. Is it possible?
C# how to treat Resharper errors as compile errors in msvs 2010?
Asked Answered
Update, since it seems people are still finding this answer:
This, or something very much like it, is possible today with e.g. StyleCop Analyzers. There's a whole bunch of analyzer tools which you can plug into the .NET compiler platform - I recommend checking out the DotNetAnalyzers GitHub org, as well as (of course) the home of the .NET compiler platform itself.
Original answer:
You can edit the type of warning that will be issued by R# under ReSharper/Options/Code Inspection/Inspection Severity.
However, this will not necessary mean that the compiler throws errors - R# isn't responsible for actually compiling the code when you hit "Build" in your project.
Yes, I've already done that and found the same thing. But I thought maybe there's a kinda hack to somehow tune the compiler. –
Hirai
@type: I doubt it - in that case, msbuild.exe probably would already emmit warnings about that. –
Baltazar
This doesn't answer the question. I'd also like to know if there is a way to get resharper errors to "break" the build. We would like 100% compliance with our Resharper rules. –
Megadeath
@m1m1k: It does answer the original question: "is it possible?" Unfortunately, the answer is "no, not to my knowledge and not without some heavy reconfiguring of the build hooks in Visual Studio". It is highly possible that you could make it work if you use a different build tool such as Ant or Maven, but eventually you'll still have to run msbuild.exe on your code, and if msbuild.exe doesn't respect your R# settings you're pretty much out of luck. –
Baltazar
This sounds like a great idea for a custom plugin. Throw compile errors when you write bad code that is new. –
Chatham
@ColacX: That plugin already exists, now under the name Stylecop.Analyzers: github.com/DotNetAnalyzers/StyleCopAnalyzers (a lot has happened since August -13...) –
Baltazar
© 2022 - 2024 — McMap. All rights reserved.