当不使用FxCop项目时,这可行:
"c:\Program Files\Microsoft FxCop 1.35\fxcopcmd.exe" /file:SiteSeeker.Core\bin\Release\SiteSeeker.Core.dll /file:SiteSeeker.CoreTest\bin\Release\SiteSeeker.CoreTest.dll /file:SiteSeeker.Example\bin\SiteSeeker.Example.dll /file:SiteSeeker.Web.WebForms\bin\Release\SiteSeeker.Web.WebForms.dll /directory:Library\NUnit\bin\net-2.0 /directory:"Library\EPiServer CMS" /directory:"Library\EPiServer CMS\5.1.422.4" /directory:"Library\EPiServer CMS\6.0.530.0" /out:FxCopResults.xml
当我有这个FxCop项目时:
<?xml version="1.0" encoding="utf-8"?>
<FxCopProject Version="1.35" Name="SiteSeeker, Release">
<ProjectOptions>
<SharedProject>True</SharedProject>
<Stylesheet Apply="False">http://www.gotdotnet.com/team/fxcop//xsl/1.35/FxCopReport.xsl</Stylesheet>
<SaveMessages>
<Project Status="None" NewOnly="False" />
<Report Status="None" NewOnly="False" />
</SaveMessages>
<ProjectFile Compress="True" DefaultTargetCheck="True" DefaultRuleCheck="True" SaveByRuleGroup="" Deterministic="True" />
<EnableMultithreadedLoad>True</EnableMultithreadedLoad>
<EnableMultithreadedAnalysis>True</EnableMultithreadedAnalysis>
<SourceLookup>True</SourceLookup>
<AnalysisExceptionsThreshold>10</AnalysisExceptionsThreshold>
<RuleExceptionsThreshold>1</RuleExceptionsThreshold>
<Spelling Locale="en-us" />
<VersionAware>False</VersionAware>
<OverrideRuleVisibilities>False</OverrideRuleVisibilities>
<CustomDictionaries SearchFxCopDir="True" SearchUserProfile="True" SearchProjectDir="True" />
<SearchGlobalAssemblyCache>False</SearchGlobalAssemblyCache>
<DeadlockDetectionTimeout>120</DeadlockDetectionTimeout>
</ProjectOptions>
<Targets>
<AssemblyReferenceDirectories>
<Directory>$(ProjectDir)/Library/EPiServer CMS/5.2.375.7/</Directory>
<Directory>$(ProjectDir)/SiteSeeker.Plugin/bin/Release/</Directory>
</AssemblyReferenceDirectories>
<Target Name="$(ProjectDir)/SiteSeeker.Core/bin/Release/SiteSeeker.Core.dll" Analyze="True" AnalyzeAllChildren="True" />
<Target Name="$(ProjectDir)/SiteSeeker.CoreTest/bin/Release/SiteSeeker.CoreTest.dll" Analyze="True" AnalyzeAllChildren="True" />
<Target Name="$(ProjectDir)/SiteSeeker.Example/bin/SiteSeeker.Example.dll" Analyze="True" AnalyzeAllChildren="True" />
<Target Name="$(ProjectDir)/SiteSeeker.Web.WebForms/bin/Release/SiteSeeker.Web.WebForms.dll" Analyze="True" AnalyzeAllChildren="True" />
</Targets>
<Rules>
<RuleFiles>
<RuleFile Name="$(FxCopDir)\Rules\DesignRules.dll" Enabled="True" AllRulesEnabled="True" />
<RuleFile Name="$(FxCopDir)\Rules\GlobalizationRules.dll" Enabled="True" AllRulesEnabled="True" />
<RuleFile Name="$(FxCopDir)\Rules\InteroperabilityRules.dll" Enabled="True" AllRulesEnabled="True" />
<RuleFile Name="$(FxCopDir)\Rules\MobilityRules.dll" Enabled="True" AllRulesEnabled="True" />
<RuleFile Name="$(FxCopDir)\Rules\NamingRules.dll" Enabled="True" AllRulesEnabled="True" />
<RuleFile Name="$(FxCopDir)\Rules\PerformanceRules.dll" Enabled="True" AllRulesEnabled="True" />
<RuleFile Name="$(FxCopDir)\Rules\PortabilityRules.dll" Enabled="True" AllRulesEnabled="True" />
<RuleFile Name="$(FxCopDir)\Rules\SecurityRules.dll" Enabled="True" AllRulesEnabled="True" />
<RuleFile Name="$(FxCopDir)\Rules\UsageRules.dll" Enabled="True" AllRulesEnabled="True" />
</RuleFiles>
<Groups />
<Settings />
</Rules>
<FxCopReport Version="1.35" />
</FxCopProject>
并使用此命令行:
fxcopcmd.exe /project:FxCopRelease.FxCop /out:FxCopResults.xml
我收到此输出并且没有写入FxCopResults.xml(它仍然不存在):
>>> fxcopcmd.exe /project:FxCopRelease.FxCop /out:FxCopResults.xml
Microsoft FxCopCmd v1.35.60623.0
Copyright (C) 1999-2006 Microsoft Corp. All rights reserved.
Loading FxCopRelease.FxCop...
Loaded DesignRules.dll...
Loaded GlobalizationRules.dll...
Loaded InteroperabilityRules.dll...
Loaded MobilityRules.dll...
Loaded NamingRules.dll...
Loaded PerformanceRules.dll...
Loaded PortabilityRules.dll...
Loaded SecurityRules.dll...
Loaded UsageRules.dll...
Initializing Introspection engine...
Analyzing...
Analysis Complete.
No messages written.
Done.
>>> type FxCopResults.xml
The system cannot find the file specified.
如果使用/ console而不是/ out,我会得到相同的输出。
首先,FxCop项目文件出现错误。我只想要那里的实际设置。所以我改变了...... 某些东西 ..这可能与这个问题有关。但是,如果尽可能,我仍然希望单独保留我的FxCop项目文件并将结果违规行为置于另一个文件中
答案 0 :(得分:3)
尝试更改消息保存设置以将活动消息保存到报告中。 e.g:
<SaveMessages>
<Project Status="None" NewOnly="False" />
<Report Status="Active" NewOnly="False" />
</SaveMessages>
答案 1 :(得分:0)
'<Stylesheet Apply="False">$(ProjectDir)/../../../program files/microsoft fxcop 1.36/Xml/FxCopReport.xsl</Stylesheet>
<SaveMessages>
<Project Status="Active" NewOnly="False" />
<Report Status="Active" NewOnly="False" />
</SaveMessages>'