我正在尝试修改 stylecop 目标以支持仅对已更改的文件进行增量检查。
调试时,我看到@(Compile) 是要检查的文件列表;但是,我想将此列表过滤为仅已更改的文件(即那些时间戳晚于目标 dll 的文件,我知道我可以将其引用为 $(TargetPath) )。
您如何递归该 createitem 的输出“StyleCopFiles”并删除那些未更改的文件?
下面是目标,我想将过滤条件添加到:
<Target Name="SetUpStyleCopProperties">
<!-- Determine what files should be checked. Take all Compile items, but exclude those that have
set ExcludeFromStyleCop=true or ExcludeFromSourceAnalysis=true. -->
<CreateItem Include="@(Compile)" Condition="('%(Compile.ExcludeFromStyleCop)' != 'true') and ('%(Compile.ExcludeFromSourceAnalysis)' != 'true')">
<Output TaskParameter="Include" ItemName="StyleCopFiles"/>
</CreateItem>
<!-- Show list of what files should be excluded. checked. Take all Compile items, but exclude those that have
set ExcludeFromStyleCop=true or ExcludeFromSourceAnalysis=true. -->
<CreateItem Include="@(Compile)" Condition="('%(Compile.ExcludeFromStyleCop)' == 'true') or ('%(Compile.ExcludeFromSourceAnalysis)' == 'true')">
<Output TaskParameter="Include" ItemName="StyleCopExcludedFiles"/>
</CreateItem>
</Target>