如何通过的MSBuild命令行指定CodeAnalysisRules [英] How to specify CodeAnalysisRules in MSBuild via commandline

查看:649
本文介绍了如何通过的MSBuild命令行指定CodeAnalysisRules的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够到指定代码AnalysisRules在命令行的MSBuild(代码分析/ FxCop的)。
项目文件将在它是这样的:

I want to be able to specify the Code AnalysisRules in commandline MSBuild (for Code Analysis / FXCOP). The project file would have something like this in it:

< CodeAnalysisRules> -Microsoft.Globalization#CA1301; - 微软。全球化#CA1302< / CodeAnalysisRules>

所以,我认为我用这样的:

So I would assume that I use something like this:

MSBuild.exe /属性:RunCodeAnalysis =真/property:CodeAnalysisRules=-Microsoft.Globalization#CA1301

,工作正常,当我要添加另一个规则,它不喜欢的分号:

Which works fine, but when I want to add another rule, it does not like the semi colon:

MSBuild.exe /属性:RunCodeAnalysis =真/property:CodeAnalysisRules=-Microsoft.Globalization#CA1301;-Microsoft.Globalization#CA1302

MSBUILD:错误MSB1006:属性无效。开关:?#-Microsoft.Globalization CA1302

我怎么可以指定多个规则

How can I specify more than one rule?

我很高兴地引用文件,但我不希望只是改变项目文件。

I am happy to reference a file, but I don't want to just change the project files.

研究背景的:我想(在我的情况哈德森)来创建一组规则进行持续集成服务器

Backgroud: I want to create a set of rules for a continuous integration server (Hudson in my case).

注意:我运行Visual Studio 2005

Note: I am running Visual Studio 2005

推荐答案

尝试这样的:对#CA1301%3B-

Try this:

msbuild /property:RunCodeAnalysis=true;CodeAnalysisRules=-Microsoft.Globalizati
on#CA1301%3B-Microsoft.Globalization#CA1302

这篇关于如何通过的MSBuild命令行指定CodeAnalysisRules的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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