在构建服务器上运行Roslyn代码分析器 [英] Run Roslyn Code Analyzers on Build Server

查看:141
本文介绍了在构建服务器上运行Roslyn代码分析器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试针对我的代码库创建自定义静态分析规则,以便如果开发人员未遵循我公司的编码约定,则会生成编译器错误.在Visual Studio 2015中,罗斯林代码分析器似乎是实现此目的的方法.

I'm trying to create custom static analysis rules against my code base such that compiler errors will be generated if a developer fails to follow my companies coding convention. It seems with Visual Studio 2015, Roslyn Code Analyzers are the way to accomplish this.

我读过的MSDN文章指出代码分析器已打包为NuGet或VSIX软件包.这对于在Visual Studio中添加红色花体非常有用,但我想确保在我的Jenkins构建服务器上也生成了编译器错误.

The MSDN articles I've read indicate Code Analyzers are packaged up as NuGet or VSIX packages. That's great for adding red squiggles in Visual Studio, but I want to make sure the compiler errors are also generated on my Jenkins build server.

罗斯林代码分析器以这种方式作为MSBuild管道的一部分运行他们会在我的构建服务器上生成编译器错误?我是否仍然需要设置MSBuild?

Are Roslyn Code Analyzers run as part of the MSBuild pipeline in such a way that they will generate compiler errors on my build server? Do I need to setup MSBuild in anyway?

推荐答案

是;分析器已与MSBuild集成.

Yes; Analyzers are integrated with MSBuild.

Visual Studio中的分析器引用是项目文件的一部分,并且Roslyn MSBuild任务会将传递给编译器.

Analyzer References in Visual Studio are part of the project file, and the Roslyn MSBuild task will pass the to the compiler.

您无需执行任何操作.

这篇关于在构建服务器上运行Roslyn代码分析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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