Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to generate XML file for analyzers on build #430

Closed
laedit opened this issue Feb 12, 2015 · 10 comments
Closed

Ability to generate XML file for analyzers on build #430

laedit opened this issue Feb 12, 2015 · 10 comments

Comments

@laedit
Copy link

laedit commented Feb 12, 2015

When "Enable Code Analysis on Build" is checked in the "Code Analysis" tab of the project properties, at each build an xml file with the name ".CodeAnalysisLog.xml is generated.

It seems that it contains only the analysis result for FxCop but not for individual parser like Code Cracker.

Is it possible to have an xml file by analyzer?
The content could be the informations showed in Visual Studio:

  • Severity
  • Code
  • Description
  • Project
  • File
  • Line
  • Column
  • Category
  • Help link
  • Details
@giggio
Copy link

giggio commented Feb 12, 2015

I like this idea very much!

@srivatsn
Copy link
Contributor

Yes we would like to produce a file. The CodeAnalysisLog.xml is generated by FxCop. I think we should add a switch to the compiler to output results in an xml file and maybe we can wire up VS to produce that file when the "Enable CodeAnalysis on Build" item is checked.

@giggio
Copy link

giggio commented Feb 13, 2015

That would be awesome!

@srivatsn
Copy link
Contributor

This has been implemented as an /errorlog switch.

@laedit
Copy link
Author

laedit commented Jan 25, 2016

Thanks for the amazing work. 😃
Is this already usable in VS2015 or elsewhere?

@srivatsn
Copy link
Contributor

Yes, it is in VS2015. You have to set the myLogFile.json switch in your project file and that will cause myLogFile.json to be created on a build.

@laedit
Copy link
Author

laedit commented Jan 25, 2016

Thanks for your answer, but I don't understand: we were talking about an xml file, is that still possible?
For the project file, is it a csproj file or the new json format?
And the "Enable CodeAnalysis on Build" is an option or not at all?

@srivatsn
Copy link
Contributor

No we chose to output the results in the SARIF Format and not XML. The project file I was referring to is the csproj file.

If you have Roslyn analyzers installed to a project, they get run on build automatically - so the "Enable CodeAnalysis on Build" option doesn't mean much. If one wants to disable codeanalysis on build, they would simply remove the analyzers from the project.

@laedit
Copy link
Author

laedit commented Jan 25, 2016

Ok, thanks for the clarification.
In my csproj I have the analyzers like this:

  <ItemGroup>
    <Analyzer Include="..\packages\codecracker.CSharp.1.0.0-rc5\analyzers\dotnet\cs\CodeCracker.Common.dll" />
    <Analyzer Include="..\packages\codecracker.CSharp.1.0.0-rc5\analyzers\dotnet\cs\CodeCracker.CSharp.dll" />
  </ItemGroup>

Is it there that I need to add a switch?

@laedit
Copy link
Author

laedit commented Jan 28, 2016

I haven't realize that it was a simple <ErrorLog>report.json</ErrorLog>.
Sorry for bothering and thanks for your help! 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants