Rick van den Bosch - Blog

... on .NET, software architecture, software development and whatnot

Recent Posts

Tags

News

  • Live space

    Photo blog

    Follow me at twitter

    Rick  van den Bosch

    LinkedIn profile

    Add to Technorati Favorites

    Disclaimer
    The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Community

Email Notifications

Blogs I read

Interesting links

Archives

August 2007 - Posts

Disable specific Code Analysis rules for a Team Build

After searching a bit, I found a way to disable specific Code Analysis rules for a team build. Or at least I thought so... The RunCodeAnalysis tag in my build.proj file is set to 'Always' to override the individual project settings, and I added the 'CodeAnalysisRules' tag to exclude some rules as a test. (See below for a part of the build.proj file.) I ran a few builds, but the tag doesn't seem to do what is supposed to. But when you use that tag in a project file, Visual Studio does recognize it as a valid tag... 

Unfortunately the build seems to execute all the rules, including the ones I tried to exclude by putting them in the CodeAnalysisRules tag with a '-' before them. I'm trying to find out if it is possible to exclude specific rules through the build file. I know it is possible to do so by putting the stuff in the CodeAnalysisRules tag my project file, but with a solution of 98 projects, this is not realy an option. ;)
I'll keep you posted. And, as always, if you have any idea: drop me a line.

Snippet build.proj file:

    <RunCodeAnalysis>Always</RunCodeAnalysis>
    <CodeAnalysisRules>-Microsoft.Globalization#CA1301;-Microsoft.Globalization#CA1302;</CodeAnalysisRules>


Edit 1
I tried Jan's suggestion (see the comments) and moved the '-' sign from in front if the Microsoft name to behind the #. This did not result in any rules being ignored either. So, unfortunately, our build still checks all rules, including the ones we don't want it to check.
By the way, I know I can set Code Analysis rules as a check-in policy, and migrate those settings to the solution, but at this point it's not possible to check out al of the 98 projects: several colleagues have projects checked out, and we're working towards a deadline, so ...

Edit 2
I also tried the suggestion David Kean posted over here, but to no avail. This might work for a project, but does not when entered in a TFS Build project. It looks like I will have to change the code analysis for all projects separately, in stead of being able to set it once for all projects in a build/solution. :(

I'm baaack ...

So, after some relaxing at home and a very cool holiday in Spain, I'm about to go to work again next monday. And with that, I'll be picking up all my 'normal day' hobbies and stuff. So, I'll try and pick up blogging (and taking pictures) again, just for you guys ;). Stay tuned ... !

 

Hey! Ho! Let's Go ..