使用 fxcopcmd.exe 运行时,使 FxCop 项目输出 XML 文件(它不输出任何有用的内容)
当不使用 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 项目文件并将结果违规放入另一个文件中。
When not using an FxCop project, this works:
"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
When I have this FxCop project:
<?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>
And use this command line:
fxcopcmd.exe /project:FxCopRelease.FxCop /out:FxCopResults.xml
I get this output and no FxCopResults.xml is written (it still does not exist):
>>> 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.
I get the same output if I use /console instead of /out.
At first the FxCop project file got filled with errors. And I only wanted the actual settings in there. So I changed... something.. It might have to do with this problem. But if it is at all possible I still would like to leave my FxCop project file alone and put the resulting violations in another file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试更改消息保存设置以将活动消息保存到报告中。例如:
Try changing the message saving settings to save active messages to the report. e.g.:
我很久以前就遇到过类似的问题。我没有将 fxcop 结果发送到 FxCopResult.xsl,我确实这样做了,问题得到了解决。
I ran into similar kind of problem long time back. I was not getting fxcop results to FxCopResult.xsl and I did like this and the issue got solved.