Deleted
Deleted

Reputation: 4217

StyleCop in MSBuild script. How make it output file only and no warnings or errors during build

I am using StyleCop 4.4.0 RTW. I have installed it, copied the contents to a version controlled directory and I've added it to each of my project files by simply adding this line to each .csproj-file:

<Import Project="..\Library\StyleCop\v4.4\Microsoft.StyleCop.targets" />

The basic functionality seems to work. When I Build a project in Visual Studio I get:

------ 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 ==========

I get PROJECTDIR\obj\Debug\StyleCopViolations.xml containing the violations.

I would like to ONLY get the StyleCop information in the output file. I do not want a warning or error. If it is possible, how do I configure it to work like that?

Upvotes: 1

Views: 2607

Answers (2)

Srikanth Dornala
Srikanth Dornala

Reputation: 71

If you open the Project Solution Folder in which StyleCop has run, there you can find one file named as StyleCop.Cache. This file contains the output of StyleCop. If you wanna see the output of StyleCop, Just you will have to open it in the Notepad.

Upvotes: 1

Julien Hoarau
Julien Hoarau

Reputation: 49970

You can't. There is no setting available in StyleCop task to have only the output file and no warnings or errors.

Possible solutions :

Upvotes: 1

Related Questions