cengizh

i have my custom rules for visual studio 2005 code analysis.

it works but i want to debug my custom rule in visual studio 2005. are there any step by step guideline or any material

any help will be appreciated.

thank you.



Re: Visual Studio Code Analysis and Code Metrics debugging "visual studio code analysis custom rules"

mahendra_nath

¡¤ Debugging custom fxcop rules - with out using stand alone fxcop 1.35

- devenv.exe with the /debugexe switch

- FxCopCmd.exe with the right arguments

- create an .fxcop project (test project on which you want to run your rules on)

fxcoptest.fxcop file -

< xml version="1.0" encoding="utf-8" >

<FxCopProject Version="8" Name="Sample Library Code Analysis Project">

<ProjectOptions>

<SharedProject>False</SharedProject>

<CompressProjectFile DefaultTargetCheck="True" DefaultRuleCheck="True">True</CompressProjectFile>

<PermitAnalysis>True</PermitAnalysis>

</ProjectOptions>

<Targets>

<Target Name="{path}\bin\Debug\FxCopTest.exe" Analyze="True" AnalyzeAllChildren="True" />

</Targets>

<RuleFiles>

<RuleFile Name="{Path}\bin\Debug\CustomFxCop.Rules.dll" Enabled="True" AllRulesEnabled="True" />

</RuleFiles>

<FxCopReport Version="8" LastAnalysis="2004-04-20 22:08:53Z"></FxCopReport>

</FxCopProject>

Make changes to the elements appropriate to your settings.

From the command prompt -

C:\Program Files\Microsoft Visual Studio 8\Common7\IDE>devenv /debugexe "C:\Prog

ram Files\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\FxCop

Cmd.exe" /p:"{path}\FxCopTest\bin\Debug\fxcoptest.fxcop" /o:"{path}/results.xml" /s

When you run the above statement, an instance of visual studio 2005 opens up and in the solution explorer you will see the FxCopCmd.exe, right click on it and select ¡®step into new instance¡¯ - place break points appropriately and debug your rule.