It looks like we were heading in vaguely the right direction. I create
the FxCop project file, adding in my rule exclusions, and then
referenced the project file using the projectFile attribute, making sure
that the <targets> and <fxcopreport> sections were empty. The task
moaned about me referencing the rules twice, so I removed the <rules>
section from the <fxcop> task, and it ran fine. So my NAnt file looks
lile this:

<fxcop  analysisReportFilename="${output.dir}\output.fxcop.xml"
                projectFile="${build.basedir}\input.fxcop" 
                failonerror="false"
                includeSummaryReport="true">
        <targets>
                <include
name="${sso.basedir}\bin\${configuration}\SSO.dll" />
                <include
name="${platform.basedir}\Common\bin\${configuration}\Common.dll" />
                <include
name="${platform.basedir}\Advertising\bin\${configuration}\Advertising.d
ll" />
                <include
name="${platform.basedir}\Billing\bin\${configuration}\Billing.dll" />
                <include
name="${platform.basedir}\Web\Controls\bin\${configuration}\Web.Controls
.dll" />
                <include
name="${platform.basedir}\Web\UI\bin\${configuration}\Web.UI.dll" />
        </targets>
        <dependencyDirectories>
                <include name="${lib.basedir}\*.dll" />
        </dependencyDirectories>
</fxcop>

while the .fxcop file looks like this:

<FxCopProject>
        <ProjectOptions>
                <!-- Snipped for brevity -->
        </ProjectOptions>
        <Targets /> <!-- Defined by the FxCop task -->
        <Rules>
                <RuleFiles>
                        <RuleFile
Name="$(FxCopDir)\Rules\DesignRules.dll" Enabled="True"
AllRulesEnabled="False">
                                <Rule
Name="AbstractTypesShouldNotHaveConstructors" Enabled="True" />
                                <Rule Name="AvoidEmptyInterfaces"
Enabled="False" />
                                <Rule
Name="AvoidExcessiveParametersOnGenericTypes" Enabled="True" />
                                <!-- Snipped for brevity -->
                        </RuleFile>
                        <!-- Snipped for brevity -->
                </RuleFiles>
        </Rules>
        <FxCopReport Version="1.36" />
</FxCopProject>

So the only real change from just using the project file to do
everything is that I have omitted the <targets> section from the project
file, and provided the targets using the <targets> element of the
<fxcop> task, which means I can use NAnt's richer expressions for
specifying which targets to analyse and when.

-----Original Message-----
From: Mike Edenfield [mailto:[EMAIL PROTECTED] 
Sent: Friday, 9 November 2007 10:47 PM
To: David Keaveny
Cc: nantcontrib-developer@lists.sourceforge.net
Subject: Re: [NAntC-Dev] Excluding rules from <fxcop>

David Keaveny wrote:

> Looking at the help files, there seems to be the possibility that 
> <imports /> could be set, but there are no examples given.

The imports element is looking for either an FxCop project file or the
output of an analysis previously done.  Both of these can be produced by
running the FxCop user interface on your DLLs first.

I'm not sure precisely how the FxCop project file is used by the task,
whether it only looks for rule exclusions or also reads the list of
assemblies to scan, but it should give you a place to start.

--
-- Mike

Still using IE? Get Firefox!
http://www.spreadfirefox.com/?q=affiliates&id=6492&t=1

The information contained in this e-mail message and any accompanying files is 
or may be confidential. If you are not the intended recipient, any use, 
dissemination, reliance, forwarding, printing or copying of this e-mail or any 
attached files is unauthorised. This e-mail is subject to copyright. No part of 
it should be reproduced, adapted or communicated without the written consent of 
the copyright owner. If you have received this e-mail in error please advise 
the sender immediately by return e-mail or telephone and delete all copies. 
Fairfax does not guarantee the accuracy or completeness of any information 
contained in this e-mail or attached files. Internet communications are not 
secure, therefore Fairfax does not accept legal responsibility for the contents 
of this message or attached files.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NAntContrib-Developer mailing list
NAntContrib-Developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nantcontrib-developer

Reply via email to