Running StyleCop Task Causes Error

Aug 11, 2010 at 6:45 PM
Edited Aug 11, 2010 at 6:53 PM

I am trying to run a sample task for scanning one .CS file with StyleCop. When I run msbuild to test the build file, I get an error that I cannot add the file for scanning:

C:\Projects\sandbox>msbuild /target:Default build_support\stylecop.build

Microsoft (R) Build Engine Version 4.0.30319.1
[Microsoft .NET Framework, Version 4.0.30319.1]
Copyright (C) Microsoft Corporation 2007. All rights reserved.

Build started 8/10/2010 5:39:12 PM.

Project "C:\Projects\sandbox\build_support\stylecop.build" on node 1 (Default target(s)).
Default:
Performing StyleCop scan...
SourceFiles count is: 1
Adding file: C:\Projects\sandbox\styleCopTest\Blah.cs
C:\Projects\sandbox\build_support\stylecop.build(9,9): error : Failed to add file: C:\Projects\sandbox\styleCopTest\Blah.cs

I verified that the file is in the path in the output above. I'm currently testing using StyleCop 4.4.0.14 and the updated extension pack. I tried with previous versions of both StyleCop and the extension pack to no avail.

Here's my stylecop.build contents:

<Project ToolsVersion="4.0" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <Import Project="$(MSBuildStartupDirectory)\build_support\common.build" />
    <Target Name="Default">
        <CreateItem Include="C:\Projects\sandbox\styleCopTest\*.cs">
            <Output TaskParameter="Include" ItemName="StyleCopFiles"/>
        </CreateItem>
        <MSBuild.ExtensionPack.CodeQuality.StyleCop 
                TaskAction="Scan" 
                SourceFiles="@(StyleCopFiles)" 
                SettingsFile="$(MSBuildExtensionsPath)\MSBuildExtensions\Settings.StyleCop">
            <Output TaskParameter="Succeeded" PropertyName="AllPassed"/>
            <Output TaskParameter="ViolationCount" PropertyName="Violations"/>
            <Output TaskParameter="FailedFiles" ItemName="Failures"/>
        </MSBuild.ExtensionPack.CodeQuality.StyleCop>
        <Message Text="Succeeded: $(AllPassed), Violations: $(Violations)"/>
        <Message Text="%(Failures.Identity) - Failed on Line %(Failures.LineNumber). %(Failures.CheckId): %(Failures.Message)"/>
    </Target>
</Project>

Thanks in advance,

Tony

Coordinator
Aug 16, 2010 at 1:24 PM

Sorry, I can't repro this. Your scripts look fine.

Mike

Dec 7, 2010 at 1:28 PM

Hi All,

I hav got exactly the same issue. Did you manage to resolve it?

Thanks in advance,

Coordinator
Dec 7, 2010 at 3:38 PM

I couldnt repro. If you could send me your repro code that would help.

Thanks

Mike

Dec 7, 2010 at 7:54 PM

This is my MSBuild code:

  <Target Name="RunSourceCodeAnalysis">

    <ItemGroup>
      <StyleCopFiles
        Include="$(SolutionRoot)\**\*.cs"
        Exclude="$(SolutionRoot)\**\*.designer.cs" />
    </ItemGroup>

    <Message Text="zkawalec: @(StyleCopFiles)" />
    <Message Text="zkawalec: $(SolutionRoot)\$(SolutionName).StyleCop" />

    
    <MSBuild.ExtensionPack.CodeQuality.StyleCop
            TaskAction="Scan"
            SourceFiles="@(StyleCopFiles)"
            SettingsFile="$(SolutionRoot)\$(SolutionName).StyleCop"
            ShowOutput="true"
            LogFile="$(SolutionRoot)\StyleCopOutput.txt" />    

  </Target>

This is the output from the MSBuild log:

Target "RunSourceCodeAnalysis" in file "C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\RunSourceCodeAnalysis.targets" from project "C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\FlyingFish.proj" (target "Hudson" depends on it):
Task "Message"
  zkawalec: C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.SeleniumTests\DefaultTest.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.SeleniumTests\Properties\AssemblyInfo.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.Services.UnitTests\GeolocationServiceTest.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.Services.UnitTests\Properties\AssemblyInfo.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.Services\GeolocationService.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.Services\IGeolocationService.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.Services\Properties\AssemblyInfo.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.Widgets.UnitTests\CountryBasedRedirectWidgetTest.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.Widgets.UnitTests\Properties\AssemblyInfo.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.Widgets\includes\controls\Breadcrumbs.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.Widgets\includes\controls\CountryBasedRedirectWidget.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.Widgets\includes\controls\footer.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.Widgets\includes\controls\header.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.Widgets\includes\controls\ImageRotator.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.Widgets\includes\controls\menu.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.Widgets\includes\controls\PhoneNumberAustralia.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.Widgets\includes\controls\PhoneNumberUK.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.Widgets\includes\controls\PhoneNumberWorld.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.Widgets\includes\controls\RedirectToFirst.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.Widgets\includes\controls\RightMenu.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.Widgets\includes\controls\YouTubeWidget.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.Widgets\Properties\AssemblyInfo.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.Widgets\UserControlTest.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.Widgets\UserControlTestFactory.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\BannerManager\dotEditor.Plugins.BannerManager\dotEditor.Plugins.BannerManager.Client\Default.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\BannerManager\dotEditor.Plugins.BannerManager\dotEditor.Plugins.BannerManager.Client\ImageRotator.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\BannerManager\dotEditor.Plugins.BannerManager\dotEditor.Plugins.BannerManager.Client\Properties\AssemblyInfo.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\BannerManager\dotEditor.Plugins.BannerManager\dotEditor.Plugins.BannerManager.DataAccess\BannerManager.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\BannerManager\dotEditor.Plugins.BannerManager\dotEditor.Plugins.BannerManager.DataAccess\Core\ExtensionMethods.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\BannerManager\dotEditor.Plugins.BannerManager\dotEditor.Plugins.BannerManager.DataAccess\Core\IDataContext.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\BannerManager\dotEditor.Plugins.BannerManager\dotEditor.Plugins.BannerManager.DataAccess\Core\IRepository.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\BannerManager\dotEditor.Plugins.BannerManager\dotEditor.Plugins.BannerManager.DataAccess\Factory\RepositoryFactory.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\BannerManager\dotEditor.Plugins.BannerManager\dotEditor.Plugins.BannerManager.DataAccess\Linq\Repository.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\BannerManager\dotEditor.Plugins.BannerManager\dotEditor.Plugins.BannerManager.DataAccess\Properties\AssemblyInfo.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\BannerManager\dotEditor.Plugins.BannerManager\dotEditor.Plugins.BannerManager.DataAccess\SerializationHelper.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\BannerManager\dotEditor.Plugins.BannerManager\dotEditor.Plugins.BannerManager\Plugins\BannerManager\Controls\ImagePicker.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\BannerManager\dotEditor.Plugins.BannerManager\dotEditor.Plugins.BannerManager\Plugins\BannerManager\Default.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\BannerManager\dotEditor.Plugins.BannerManager\dotEditor.Plugins.BannerManager\Plugins\BannerManager\ItemEdit.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\CurrencyManagement\dotEditor.Plugins.CurrencyManagement\dotEditor.Plugins.CurrencyManagement.DataAccess\AvailableCurrencies.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\CurrencyManagement\dotEditor.Plugins.CurrencyManagement\dotEditor.Plugins.CurrencyManagement.DataAccess\Core\ExtensionMethods.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\CurrencyManagement\dotEditor.Plugins.CurrencyManagement\dotEditor.Plugins.CurrencyManagement.DataAccess\Core\IDataContext.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\CurrencyManagement\dotEditor.Plugins.CurrencyManagement\dotEditor.Plugins.CurrencyManagement.DataAccess\Core\IRepository.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\CurrencyManagement\dotEditor.Plugins.CurrencyManagement\dotEditor.Plugins.CurrencyManagement.DataAccess\CurrencyManagement.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\CurrencyManagement\dotEditor.Plugins.CurrencyManagement\dotEditor.Plugins.CurrencyManagement.DataAccess\Factory\RepositoryFactory.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\CurrencyManagement\dotEditor.Plugins.CurrencyManagement\dotEditor.Plugins.CurrencyManagement.DataAccess\Linq\CurrencyRepository.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\CurrencyManagement\dotEditor.Plugins.CurrencyManagement\dotEditor.Plugins.CurrencyManagement.DataAccess\Linq\Repository.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\CurrencyManagement\dotEditor.Plugins.CurrencyManagement\dotEditor.Plugins.CurrencyManagement.DataAccess\Properties\AssemblyInfo.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\CurrencyManagement\dotEditor.Plugins.CurrencyManagement\dotEditor.Plugins.CurrencyManagement.DataAccess\Repository\ICurrencyRepository.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\CurrencyManagement\dotEditor.Plugins.CurrencyManagement\dotEditor.Plugins.CurrencyManagement.DataAccess\SerializationHelper.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\CurrencyManagement\dotEditor.Plugins.CurrencyManagement\dotEditor.Plugins.CurrencyManagement.DataAccess\WebService\CurrencyRepository.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\CurrencyManagement\dotEditor.Plugins.CurrencyManagement\dotEditor.Plugins.CurrencyManagement\Plugins\CurrencyManagement\Currencies.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\CurrencyManagement\dotEditor.Plugins.CurrencyManagement\dotEditor.Plugins.CurrencyManagement\Plugins\CurrencyManagement\CurrencyEdit.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\CurrencyManagement\dotEditor.Plugins.CurrencyManagement\dotEditor.Plugins.CurrencyManagement\Plugins\CurrencyManagement\CurrencyEdit.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\CurrencyManagement\dotEditor.Plugins.CurrencyManagement\dotEditor.Plugins.CurrencyManagement\Plugins\CurrencyManagement\Default.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\CurrencyManagement\dotEditor.Plugins.CurrencyManagement\dotEditor.Plugins.CurrencyManagement\Plugins\CurrencyManagement\ExchangeRates.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\CurrencyManagement\dotEditor.Plugins.CurrencyManagement\dotEditor.Plugins.CurrencyManagement\Plugins\CurrencyManagement\ExchangeRateUpdateScheduler.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement.DataAccess\CourseManagement.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement.DataAccess\DataContextModule.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement.DataAccess\Properties\AssemblyInfo.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement.DataAccess\SerializationHelper.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\About.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Account\ChangePassword.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Account\ChangePasswordSuccess.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Account\Login.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Account\Register.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Default.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Global.asax.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Plugins\CourseManagement\ActivitiesView.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Plugins\CourseManagement\ActivityEdit.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Plugins\CourseManagement\Controls\AddRemoveControl.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Plugins\CourseManagement\Controls\CourseInstanceCode.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Plugins\CourseManagement\Controls\CourseInstanceLocationAndDate.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Plugins\CourseManagement\Controls\CourseInstancePrice.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Plugins\CourseManagement\Controls\CourseManagementTab.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Plugins\CourseManagement\Controls\DocumentPicker.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Plugins\CourseManagement\Controls\ImagePicker.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Plugins\CourseManagement\CourseEdit.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Plugins\CourseManagement\CourseInstanceEdit.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Plugins\CourseManagement\CourseInstanceView.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Plugins\CourseManagement\CourseView.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Plugins\CourseManagement\Default.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Plugins\CourseManagement\DestinationEdit.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Plugins\CourseManagement\DestinationsView.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Plugins\CourseManagement\LocationEdit.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Plugins\CourseManagement\LocationsView.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Plugins\CourseManagement\QualificationEdit.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Plugins\CourseManagement\QualificationView.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Plugins\CourseManagement\ReasonForJoiningEdit.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Plugins\CourseManagement\ReasonsForJoiningView.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Properties\AssemblyInfo.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\dotEditor.Plugins.CourseManagement\Site.Master.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\NewsPicker\dotEditor.Plugins.NewsPicker\dotEditor.Plugins.NewsPicker.DataAccess\Core\ExtensionMethods.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\NewsPicker\dotEditor.Plugins.NewsPicker\dotEditor.Plugins.NewsPicker.DataAccess\Core\IDataContext.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\NewsPicker\dotEditor.Plugins.NewsPicker\dotEditor.Plugins.NewsPicker.DataAccess\Core\IRepository.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\NewsPicker\dotEditor.Plugins.NewsPicker\dotEditor.Plugins.NewsPicker.DataAccess\Factory\NewsRepository.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\NewsPicker\dotEditor.Plugins.NewsPicker\dotEditor.Plugins.NewsPicker.DataAccess\Factory\RepositoryFactory.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\NewsPicker\dotEditor.Plugins.NewsPicker\dotEditor.Plugins.NewsPicker.DataAccess\Linq\NewsItemRepository.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\NewsPicker\dotEditor.Plugins.NewsPicker\dotEditor.Plugins.NewsPicker.DataAccess\Linq\Repository.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\NewsPicker\dotEditor.Plugins.NewsPicker\dotEditor.Plugins.NewsPicker.DataAccess\NewsItem.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\NewsPicker\dotEditor.Plugins.NewsPicker\dotEditor.Plugins.NewsPicker.DataAccess\NewsPicker.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\NewsPicker\dotEditor.Plugins.NewsPicker\dotEditor.Plugins.NewsPicker.DataAccess\Properties\AssemblyInfo.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\NewsPicker\dotEditor.Plugins.NewsPicker\dotEditor.Plugins.NewsPicker.DataAccess\Repository\INewsItemRepository.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\NewsPicker\dotEditor.Plugins.NewsPicker\dotEditor.Plugins.NewsPicker\Plugins\NewsPicker\Default.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\NewsPicker\dotEditor.Plugins.NewsPicker\dotEditor.Plugins.NewsPicker\Plugins\NewsPicker\NewsView.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\PreviewEvents\dotEditor.Plugins.PreviewEvents\dotEditor.Plugins.PreviewEvents.DataAccess\Core\ExtensionMethods.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\PreviewEvents\dotEditor.Plugins.PreviewEvents\dotEditor.Plugins.PreviewEvents.DataAccess\Core\IDataContext.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\PreviewEvents\dotEditor.Plugins.PreviewEvents\dotEditor.Plugins.PreviewEvents.DataAccess\Core\IRepository.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\PreviewEvents\dotEditor.Plugins.PreviewEvents\dotEditor.Plugins.PreviewEvents.DataAccess\Factory\RepositoryFactory.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\PreviewEvents\dotEditor.Plugins.PreviewEvents\dotEditor.Plugins.PreviewEvents.DataAccess\Linq\Repository.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\PreviewEvents\dotEditor.Plugins.PreviewEvents\dotEditor.Plugins.PreviewEvents.DataAccess\PreviewEvents.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\PreviewEvents\dotEditor.Plugins.PreviewEvents\dotEditor.Plugins.PreviewEvents.DataAccess\Properties\AssemblyInfo.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\PreviewEvents\dotEditor.Plugins.PreviewEvents\dotEditor.Plugins.PreviewEvents.DataAccess\SerializationHelper.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\PreviewEvents\dotEditor.Plugins.PreviewEvents\dotEditor.Plugins.PreviewEvents\Plugins\PreviewEvents\Controls\DateTimePicker.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\PreviewEvents\dotEditor.Plugins.PreviewEvents\dotEditor.Plugins.PreviewEvents\Plugins\PreviewEvents\Default.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\PreviewEvents\dotEditor.Plugins.PreviewEvents\dotEditor.Plugins.PreviewEvents\Plugins\PreviewEvents\IRepository.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\PreviewEvents\dotEditor.Plugins.PreviewEvents\dotEditor.Plugins.PreviewEvents\Plugins\PreviewEvents\ItemEdit.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\UserManagement\UserManagement\dotEditor.Plugins.UserManagement.DataAccess\Core\ExtensionMethods.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\UserManagement\UserManagement\dotEditor.Plugins.UserManagement.DataAccess\Core\IDataContext.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\UserManagement\UserManagement\dotEditor.Plugins.UserManagement.DataAccess\Core\IRepository.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\UserManagement\UserManagement\dotEditor.Plugins.UserManagement.DataAccess\Factory\RepositoryFactory.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\UserManagement\UserManagement\dotEditor.Plugins.UserManagement.DataAccess\Linq\Repository.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\UserManagement\UserManagement\dotEditor.Plugins.UserManagement.DataAccess\Linq\UserRepository.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\UserManagement\UserManagement\dotEditor.Plugins.UserManagement.DataAccess\ListSelector.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\UserManagement\UserManagement\dotEditor.Plugins.UserManagement.DataAccess\Properties\AssemblyInfo.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\UserManagement\UserManagement\dotEditor.Plugins.UserManagement.DataAccess\Repository\IUserRepository.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\UserManagement\UserManagement\dotEditor.Plugins.UserManagement.DataAccess\UserManagement.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\UserManagement\UserManagement\dotEditor.Plugins.UserManagement\Plugins\UserManagement\Controls\AddressEditControl.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\UserManagement\UserManagement\dotEditor.Plugins.UserManagement\Plugins\UserManagement\Controls\DateTimePicker.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\UserManagement\UserManagement\dotEditor.Plugins.UserManagement\Plugins\UserManagement\Controls\DocumentPicker.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\UserManagement\UserManagement\dotEditor.Plugins.UserManagement\Plugins\UserManagement\Controls\PasswordEditControl.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\UserManagement\UserManagement\dotEditor.Plugins.UserManagement\Plugins\UserManagement\Default.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\UserManagement\UserManagement\dotEditor.Plugins.UserManagement\Plugins\UserManagement\JobAdvertiserInfoEdit.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\UserManagement\UserManagement\dotEditor.Plugins.UserManagement\Plugins\UserManagement\JobSeekerInfoEdit.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\UserManagement\UserManagement\dotEditor.Plugins.UserManagement\Plugins\UserManagement\SiteAccessEdit.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\UserManagement\UserManagement\dotEditor.Plugins.UserManagement\Plugins\UserManagement\UserEdit.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\UserManagement\UserManagement\dotEditor.Plugins.UserManagement\Plugins\UserManagement\UserEdit.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\UserManagement\UserManagement\dotEditor.Plugins.UserManagement\Plugins\UserManagement\UserInfoEdit.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Plugins\UserManagement\UserManagement\dotEditor.Plugins.UserManagement\Plugins\UserManagement\UserView.ascx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Utilities\Ip2LocationMock\Default.aspx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Utilities\Ip2LocationMock\IPCountryHandler.ashx.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Utilities\Ip2LocationMock\Properties\AssemblyInfo.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Utilities\WebMock\MockWebRequest.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Utilities\WebMock\MockWebRequestCreate.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Utilities\WebMock\MockWebResponse.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Utilities\WebMock\NativeMethods.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Utilities\WebMock\Properties\AssemblyInfo.cs;C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\Utilities\WebMock\TestWebServer.cs
Done executing task "Message".
Task "Message"
  zkawalec: C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.StyleCop
Done executing task "Message".
Using "MSBuild.ExtensionPack.CodeQuality.StyleCop" task from assembly "C:\Program Files (x86)\MSBuild\ExtensionPack\4.0\\MSBuild.ExtensionPack.StyleCop.dll".
Task "MSBuild.ExtensionPack.CodeQuality.StyleCop"
  Performing StyleCop scan...
  SourceFiles count is: 147
  Adding file: C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.SeleniumTests\DefaultTest.cs
C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\RunSourceCodeAnalysis.targets(16,5): error : Failed to add file: C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\..\FlyingFish.SeleniumTests\DefaultTest.cs [C:\Hudson\bin\jobs\Flying FishM\workspace\BuildScripts\FlyingFish.proj]
Done executing task "MSBuild.ExtensionPack.CodeQuality.StyleCop" -- FAILED.
Done building target "RunSourceCodeAnalysis" in project "FlyingFish.proj" -- FAILED.

 

I have got the Style Cop 4.4.0.14 installed on the build machine under "Program Files (x86)\Microsoft StyleCop 4.4.0.14\".

Also, I put the Style Cop DLLs into the GAC (I was resolving some other problems, maybe I was desperate ;)

I have double checked the paths and I am 100% sure they are correct.

The "StyleCopOutput.txt" file is not created.

 

Please, give me a shout, if you need anything else.

Thanks,

Coordinator
Dec 8, 2010 at 10:30 AM

Sorry, again I cant repro this.

That error is being raised because for some reason stylecop is not adding the file to scan.

 

                    if (this.ShowOutput)
                    {
                        this.LogTaskMessage(string.Format(CultureInfo.CurrentCulture, "Adding file: {0}", item2.ItemSpec));
                    }

                    if (!console.Core.Environment.AddSourceCode(project, item2.ItemSpec, null))
                    {
                        Log.LogError(string.Format(CultureInfo.CurrentCulture, "Failed to add file: {0}", item2.ItemSpec));
                        return;
                    }

 

I can not think why this is happening.

I see two hits on the StyleCop site: http://stylecop.codeplex.com/Thread/View.aspx?ThreadId=220546 & http://stylecop.codeplex.com/Thread/View.aspx?ThreadId=233627 for AddSourceCode.

Does this task work at all for you or is it just failing on this project?

Mike

Dec 8, 2010 at 1:24 PM

Hi all,

I've got it working now.

 

I found out, that the Style Cop installation was somehow corrupted. It was not integrated with the Visual Studio and the Style Cop Settings Editor could not load any rules.

I've uninstalled everything (evern from the GAC which I have had installed earlier), install the Style Cop 4.4 again, and followed that hint: http://msbuildextensionpack.codeplex.com/Thread/View.aspx?ThreadId=82298

Now all works fine.

 

Thank you for you help!

Coordinator
Dec 8, 2010 at 1:46 PM

Thanks for the feedback and resolution!

 

Mike