tag:help.appveyor.com,2012-11-13:/discussions/kb/5-code-analysis-fxcop-supportAppVeyor: Discussion 2018-10-19T08:16:45Ztag:help.appveyor.com,2012-11-13:Comment/345861602014-09-15T21:20:15Z2014-09-15T21:20:15ZCode Analysis (FxCop) support<div><p>I have seen in a <a href=
"http://help.appveyor.com/discussions/problems/58-does-appveyor-support-code-analysis-correctly">
previous discuss</a> that Code Analysis is not supported.</p>
<p>This is something we use but given it an impact on build times,
on one huge project we've limited it only to release builds, and
therefore it was only picked up on our build server (then
TeamCity).</p>
<p>Now that we've moved to AppVeyor for both our CI build and
deployment, we pretty much never build release builds and as a
result the Code Analysis issues are not being picked up.</p>
<p>Is this something that can be added easily?</p></div>James Skimmingtag:help.appveyor.com,2012-11-13:Comment/345861602014-09-15T22:06:52Z2014-09-15T22:06:52ZCode Analysis (FxCop) support<div><p>Hi James,</p>
<p>We could provide FxCop 10.0 which is a part of Windows SDK.
Would it work for you?</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/345861602014-09-16T08:37:31Z2014-09-16T08:37:31ZCode Analysis (FxCop) support<div><p>Hi Feodor, it looks like v12 is the one that bundles with VS
2013 (presumably matching the VS version)</p>
<p>I've not tried it from the Windows SDK version, will it still
run as part build or would we need to add separate build steps for
AppVeyor?</p>
<p>Is the reason it's not already present because its not part of
the express variant of Visual Studio?</p></div>James Skimmingtag:help.appveyor.com,2012-11-13:Comment/345861602014-09-18T17:14:41Z2014-09-18T17:14:41ZCode Analysis (FxCop) support<div><p>Right, FxCop 12 is part of Code Analysis tools which are the
part of VS Ultimate edition.</p>
<p><a href=
"https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/3243367-update-standalone-fxcop-to-support-net-4-5-and-po">
https://visualstudio.uservoice.com/forums/121579-visual-studio/sugg...</a></p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/345861602014-09-22T12:37:49Z2014-09-22T12:37:49ZCode Analysis (FxCop) support<div><p>Fedeor, did you decide if you were going to add FxCop 10.0? Or
is it already available on the Build Worker?</p>
<p>Thanks!</p></div>gep13tag:help.appveyor.com,2012-11-13:Comment/345861602014-09-22T17:03:17Z2014-09-22T17:03:17ZCode Analysis (FxCop) support<div><p>It's not yet available. Will install it today.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/345861602014-09-22T17:17:42Z2014-09-22T17:17:42ZCode Analysis (FxCop) support<div><p>Sweet! Looking forward to trying it out!</p>
<p>Sent from my Windows Phone</p>
<hr></div>gep13tag:help.appveyor.com,2012-11-13:Comment/345861602014-09-23T04:49:10Z2014-09-23T04:49:10ZCode Analysis (FxCop) support<div><p>FxCop 10.0 has been installed into: <code>C:\Program Files
(x86)\Microsoft Fxcop 10.0</code></p>
<p>There is <code>FxCopCmd.exe</code> to run from command line.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/345861602014-09-23T19:58:43Z2014-09-23T19:58:43ZCode Analysis (FxCop) support<div><p>Just wanted to confirm that I was able to get Code Analysis to
run, including on a .Net 4.5 project. Turns out, Code Analysis is
now included in the Express Editions of Visual Studio, so no need
for an updated SDK to include it, as it is already there.</p>
<p>Thanks</p></div>gep13tag:help.appveyor.com,2012-11-13:Comment/345861602014-09-23T20:00:40Z2014-09-23T20:00:40ZCode Analysis (FxCop) support<div><p>Have you used any special syntax/build step to make it work? Or
it's just VS 2013 project with code analysis on?</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/345861602014-09-23T20:43:53Z2014-09-23T20:43:53ZCode Analysis (FxCop) support<div><p>Nope, nothing really special.</p>
<p>I added the Build.FxCop nuget package, which adds the necessary
Code Analysis settings to each project. The only thing I had to do
in addition to this was to create an additional Import Statement to
set the output file location that I wanted.</p>
<p>From there, I invoked MSBuild from my psake script, and Code
Analysis was then executed.</p>
<p>You can see the changes that I made here:</p>
<p><a href=
"https://github.com/chocolatey/ChocolateyGUI/commit/941b83917866f189caac0fb6abe155da3dcdbe1c">
https://github.com/chocolatey/ChocolateyGUI/commit/941b83917866f189...</a></p>
<p>and the resulting build here:</p>
<p><a href=
"https://ci.appveyor.com/project/GaryEwanPark/chocolateygui/build/0.12.0-unstable.50+50%20(Build%2071)">
https://ci.appveyor.com/project/GaryEwanPark/chocolateygui/build/0....</a></p>
<p>Which failed due to 226 Code Analysis violations, which I now
need to fix :-)</p></div>gep13tag:help.appveyor.com,2012-11-13:Comment/345861602014-09-23T21:28:12Z2014-09-23T21:28:12ZCode Analysis (FxCop) support<div><p>Cool, thanks for the guide! I'll move this thread to KB section.
Seamless FxCop support is great value for AV platform.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/345861602014-10-08T21:24:19Z2014-10-08T21:24:19ZCode Analysis (FxCop) support<div><p>For those that might be interested, I have just finished
completing some tests which allow me to analyse the output of a
Code Analysis test, and if there are any violations, report them as
errors in the Tests section of the AppVeyor Build page.</p>
<p>If breaks down as follows:</p>
<pre>
<code>function analyseCodeAnalysisResults( [Parameter(ValueFromPipeline=$true)]$codeAnalysisResultsFile ) {
$codeAnalysisErrors = [xml](Get-Content $codeAnalysisResultsFile);
foreach ($codeAnalysisError in $codeAnalysisErrors.SelectNodes("//Message")) {
$issueNode = $codeAnalysisError.SelectSingleNode("Issue");
Write-Host "Violation of Rule $($codeAnalysisError.CheckId): $($codeAnalysisError.TypeName) Line Number: $($issueNode.Line) FileName: $($issueNode.Path)\$($codeAnalysisError.Issue.File) ErrorMessage: $($issueNode.InnerXml)";
if(isAppVeyor) {
Add-AppveyorTest "Violation of Rule $($codeAnalysisError.CheckId): $($codeAnalysisError.TypeName) Line Number: $($issueNode.Line)" -Outcome Failed -FileName "$($issueNode.Path)\$($codeAnalysisError.Issue.File)" -ErrorMessage $($issueNode.InnerXml);
}
}
if(isAppVeyor) {
Push-AppveyorArtifact $codeAnalysisResultsFile;
}
}</code>
</pre>
<p>Hopefully this will help anyone who is looking to do something
similar.</p>
<p>You can see an example of the test errors reported here:</p>
<p><a href=
"https://ci.appveyor.com/project/GaryEwanPark/chocolateygui/build/0.12.0-PullRequest.179+16%20(Build%20106)/tests">
https://ci.appveyor.com/project/GaryEwanPark/chocolateygui/build/0....</a></p>
<p>NOTE: The missing line number is due to the particular CA error
not actually reporting the line number where the error occured.</p></div>gep13tag:help.appveyor.com,2012-11-13:Comment/345861602014-11-10T08:03:18Z2014-11-10T08:03:19ZCode Analysis (FxCop) support<div><p>you've mentioned a Build.FxCop nuget package. I couldn't find it
and i think you were referring to BuildTools.FxCop: <a href=
"http://www.nuget.org/packages/BuildTools.FxCop/">http://www.nuget.org/packages/BuildTools.FxCop/</a><br>
(just in case someone else is going to look for it).</p></div>Bruno Juchlitag:help.appveyor.com,2012-11-13:Comment/345861602014-11-10T08:07:28Z2014-11-10T08:07:28ZCode Analysis (FxCop) support<div><p>Yes, my mistake. I was typing the nuget package name from
memory, I should have looked it up. The package that you have
linked to is the one that I have used.</p></div>gep13