# Wednesday, August 09, 2006

I'm currently helping a customer to migrate a *really large* web application from ASP.NET 1.1 to 2.0 (round about 130 projects in the master solution...).

I always liked FxCop but enabling "Code Analysis" manually is way to complicated (or not geekish enough?!?). So I wrote this small macro this morning.

Imports System

Imports System.Diagnostics

Imports System.Text

Imports System.Windows.Forms

 

Imports EnvDTE

Imports EnvDTE80

 

Public Module CodeAnalysis

 

    Public Sub EnableFxCop()

        Dim objProj As Object()

        Dim proj As Project

 

        For i As Integer = 1 To DTE.Solution.Projects.Count

            proj = DTE.Solution.Projects.Item(i)

            EnableFxCop(proj)

        Next

    End Sub

 

    Private Sub EnableFxCop(ByVal project As Project)

 

        If project.Kind = "{66A26720-8FB5-11D2-AA7E-00C04F688DDE}" Then

            'Filter Project Folders

            For Each subProject As ProjectItem In project.ProjectItems

                EnableFxCop(subProject.SubProject)

            Next

        Else

            project.ConfigurationManager.ActiveConfiguration.Properties.Item( _

                "RunCodeAnalysis").Value = "True"

 

            project.ConfigurationManager.ActiveConfiguration.Properties.Item( _

                "CodeAnalysisRules").Value = String.Concat( _

                    "-Microsoft.Design#CA2210;", _

                    "-Microsoft.Design#CA1020;", _

                    "-Microsoft.Naming#CA1705;", _

                    "-Microsoft.Naming#CA1709")

            project.Save()

        End If

    End Sub

End Module

Wednesday, August 09, 2006 1:50:21 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [2]  |  Related posts:
NRW Conf 09
Project Springboard
UrlAuthorization with ASP.NET Routing
ASP.NET Routing for URLRewriting with QueryStrings
ASP.NET Routing for URLRewiting
Simplify LINQ code?
Tracked by:
"Macro to enable Code Analysis and define FxCop rules" (Fred's Brain Waves) [Trackback]
/Web/blogs/fxcop/archive/2006/08/11/TIP_3A00_-How-to-quickly-enable-Code-Analysi... [Pingback]
"bay area photographer" (bay area photographer) [Trackback]
"maryland automotive windshield" (maryland automotive windshield) [Trackback]
"her first audition" (her first audition) [Trackback]
"buyphentermineprozac" (buyphentermineprozac) [Trackback]
"annuncio affitti isernia" (annuncio affitti isernia) [Trackback]
"paul posey tallahassee florida" (paul posey tallahassee florida) [Trackback]
"sauna mista milano" (sauna mista milano) [Trackback]
"una sera nel parco" (una sera nel parco) [Trackback]
"georgia bulldog" (georgia bulldog) [Trackback]
"pacifica armoire" (pacifica armoire) [Trackback]
"vecchie mature grasse donne" (vecchie mature grasse donne) [Trackback]
"cd organizers" (cd organizers) [Trackback]
"female body builders posing" (female body builders posing) [Trackback]
"congelatore da incasso" (congelatore da incasso) [Trackback]
"cameriere in autoreggenti" (cameriere in autoreggenti) [Trackback]
"Sports Betting Rss Feed" (Sports Betting Rss Feed) [Trackback]
"albuquerque respiratory jobs va medical center" (albuquerque respiratory jobs v... [Trackback]
"tiaras and headpieces" (tiaras and headpieces) [Trackback]
"used kountry aire camper trailer" (used kountry aire camper trailer) [Trackback]
"bollente fantastico nubile" (bollente fantastico nubile) [Trackback]
"invisibile pulcino dildo" (invisibile pulcino dildo) [Trackback]
"bitches getting fuck" (bitches getting fuck) [Trackback]
"fotografico" (fotografico) [Trackback]
"how to make a sword" (how to make a sword) [Trackback]
"sms gratis cellulare" (sms gratis cellulare) [Trackback]
"racconto erotici con animali" (racconto erotici con animali) [Trackback]
"teen dating forum" (teen dating forum) [Trackback]
"west virginia dui law" (west virginia dui law) [Trackback]
"poor girls for marriage" (poor girls for marriage) [Trackback]
"viaggi abruzzo" (viaggi abruzzo) [Trackback]
"TIP: How to quickly enable Code Analysis on multiple projects [David Kean]" (Vi... [Trackback]
"Code Analysis in .NET" (Michael Flanakin) [Trackback]