从命令行调用Roslyn分析仪 [英] Calling Roslyn Analyzers from command line

查看:269
本文介绍了从命令行调用Roslyn分析仪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio 2015中开发时使用Roslyn分析器是伟大的。然而,从预提交钩子或CI(如TeamCity)调用分析器以确保不一致的代码被标记将是更大的。

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?

推荐答案

p> Roslyn Analyzers可以通过csc.exe或vbc.exe(编译器自己)运行,因此只需调用编译器。假设您的持续集成已经构建,并且您的分析器已添加到项目文件或NuGet包中,则应该已经可以正常工作了。

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™.

这篇关于从命令行调用Roslyn分析仪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆