I have a .NET Core 2.0 project for which I would like to perform code analysis from the command line and write the output to disk. Per the discussion here, I have referenced the Microsoft.CodeAnalysis.FxCopAnalyzers Nuget package (enabled for both Debug and Release configurations). I am running the following command from the command line:
"C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/MSBuild/15.0/Bin/amd64/MSBuild.exe" /p:Configuration="Debug" /p:CodeAnalysisLogFile=MyCodeAnalysisLogFile2.xml /target:Build "C:/Source/TestProject/TestProject.sln"
From the resulting output, I can see that code analysis is being applied and rules are violating as expected. However, no log file is being written to disk, and the CodeAnalysisLogFile
property seems to have no effect. I've also tried CodeAnalysisOutputFile
to no avail.
I'd like to get an XML code analysis output just like in the old days. How do I get the code analysis output written to disk when using the Roslyn compiler?