April 9, 2014 | Posted in: .Net

I spent a considerable amount of time trying to find all of the VB.Net and C# check id’s so that I could treat a select few warnings as errors. The truth of it is, that the Visual Basic compiler is a lot less picky than the C# compiler. As an example, the default behaviour of the C# compiler is to tell you that a function has no return value (as an error), whereas in the land of Visual Basic you need to specify this under VB Project -> Compile -> Warning Configurations (Condition “Unused local variable” = “Error”). This instructs the Visual Basic compiler to treat these warnings as errors and as you would expect, they then show up in your errors list.

There seem to be very few options for Visual Basic projects to achieve this for many of the desired warnings as errors, but the following should get you started:

http://msdn.microsoft.com/en-us/library/3y20cc1z.aspx

I’ve also managed to find the C# equivilent URL which lists the check id’s here:

http://msdn.microsoft.com/en-us/library/dd380629.aspx

NOTE: If you exceed the maximum number of warnings in Visual Studio and you are treating them as errors, the errors will not show if they are out of scope and will effectively be hidden!! Watch out for this.

Be the first to comment.

Leave a Reply

*


four − two =


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>