我正在使用StyleCop 4.4.0 RTW。我已经安装了它,将内容复制到版本控制的目录中,我已经将它添加到我的每个项目文件中,只需将此行添加到每个.csproj文件中:
<Import Project="..\Library\StyleCop\v4.4\Microsoft.StyleCop.targets" />
基本功能似乎有效。当我在Visual Studio中构建项目时,我得到:
------ Build started: Project: MyProject.Core, Configuration: Debug Any CPU ------
C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.EnterpriseServices.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Web.Services.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /debug+ /debug:full /filealign:512 /keyfile:..\Build\myproject.snk /optimize- /out:obj\Debug\MyProject.Core.dll /target:library Controller\AcceptAllAccessController.cs Controller\NoSearchSessionSpecifiedException.cs Controller\DenyAllAccessController.cs Controller\SearchContextExpiredException.cs Controller\SearchEngineFacade.cs Environment\ConnectionSettings.cs Environment\IAccessController.cs Environment\ICache.cs Model\Age.cs Model\Bet.cs Model\Category.cs Model\CategoryGroup.cs Model\Click.cs Model\DateTimeInfo.cs Model\DateTimeRange.cs Model\FileFormat.cs Model\FileFormatCollection.cs Model\Hit.cs Model\Language.cs Model\MetaAttributes.cs Model\QueryCompletionResponse.cs Model\QueryRefinement.cs Model\SearchContext.cs Model\SearchFilter.cs Model\SearchFilterCollection.cs Model\SearchRequest.cs Model\SearchResponse.cs Model\Session.cs Model\SortOrder.cs Model\SpellingSuggestion.cs Properties\AssemblyInfo.cs Util\HexEncoding.cs Util\ParameterConv.cs Util\StringUtil.cs "Web References\WebService\Reference.cs"
Compile complete -- 0 errors, 0 warnings
MyProject.Core -> C:\Users\kentl\Documents\Visual Studio 2008\Projects\WebToWebForms\MyProject.Core\bin\Debug\MyProject.Core.dll
Controller\AcceptAllAccessController.cs(15,1): warning : SA1508: A closing curly bracket must not be preceded by a blank line.
Done building project "MyProject.Core.csproj".
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
我得到包含违规行为的PROJECTDIR \ _ obj \ Debug \ StyleCopViolations.xml。
我想只在输出文件中获取StyleCop信息。我不想要警告或错误。如果可能的话,我该如何配置它呢?
答案 0 :(得分:1)
你做不到。 StyleCop
任务中没有可用的设置只包含输出文件,没有警告或错误。
可能的解决方案:
答案 1 :(得分:0)
如果您打开运行StyleCop的项目解决方案文件夹,则可以找到一个名为 StyleCop.Cache 的文件。该文件包含StyleCop的输出。如果你想看看StyleCop的输出,你只需要在记事本中打开它。