问题
Using Roslyn Analyzers while developing in Visual Studio 2015 is great. However, it would be even greater to be able to call analyzers from a pre-commit hook or a CI like TeamCity in order to make sure non-conformant code is flagged.
Is there any way to get the results of an analyzer by calling a command line utility or will this need to be custom made?
回答1:
Roslyn Analyzers can be ran by csc.exe or vbc.exe (the compilers themselves), so just invoke the compiler. Assuming your Continuous Integration is already building, and your analyzers are added to the project file or to a NuGet package, this should Already Be Working™.
来源:https://stackoverflow.com/questions/35322126/calling-roslyn-analyzers-from-command-line