代码分析 FXCop VSTS 2015 配置

Code Analysis FXCop VSTS 2015 configuration

我正在尝试在现有构建定义中为 CI 配置代码分析任务。代码编译得很好。我已将代码分析配置为执行最低规则。但是,我收到以下错误(从控制台日志复制)。

Starting Code Analysis
Include file: d:\a\s\bin\d:\a\s\bin\SampleAppCICD.dll
/ruleset:+C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\ManagedMinimumRules.ruleset /Summary /out:d:\a\s\codeanalysisresult.html /verbose /outXsl:C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\FxCop\xml\FxCopReport.xsl /applyoutXsl
Microsoft (R) FxCop Command-Line Tool, Version 14.0 (14.0.25420.1) X86
Copyright (C) Microsoft Corporation, All Rights Reserved.
Loaded dataflowrules.dll...
Loaded designrules.dll...
Loaded globalizationrules.dll...
Loaded interoperabilityrules.dll...
Loaded maintainabilityrules.dll...
Loaded mobilityrules.dll...
Loaded namingrules.dll...
Loaded performancerules.dll...
Loaded portabilityrules.dll...
Loaded reliabilityrules.dll...
Loaded securityrules.dll...
Loaded securitytransparencyrules.dll...
Loaded usagerules.dll...
Rule set found at 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\ManagedMinimumRules.ruleset'
System.Management.Automation.RemoteException: * Analysis was not performed; at least one valid rules assembly and one valid
Processed: ##vso[task.logissue type=error;]System.Management.Automation.RemoteException: * Analysis was not performed; at least one valid rules assembly and one valid
System.Management.Automation.RemoteException: target file must be specified.
Processed: ##vso[task.logissue type=error;]System.Management.Automation.RemoteException: target file must be specified.
System.Management.Automation.RemoteException: * 1 total analysis engine exceptions.

您在文件输入框中指定的文件不正确,它基于您指定的构建目录

例如SampleAppCICD.dll路径为d:\a\s\bin\SampleAppCICD.dll($(build.sourcesDirectory)值为d:\a\s) ,然后建立目录输入框:$(build.sourcesDirectory)\bin; 文件的输入框:SampleAppCICD.dll.