[TFS2013团队构建] [静态代码分析]参数问题中的双反斜杠 [英] [TFS2013 Team Builds] [Static Code Analysis] double backslash in parameter problem

查看:107
本文介绍了[TFS2013团队构建] [静态代码分析]参数问题中的双反斜杠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的社区,


首先,快速事实:



  • 我们正在使用Team Foundation Server 2013 Update 4
  • 和Visual Studio 2015 Update 3

作为质量改进流程的一部分,我们希望使用"静态分析工具" ;作为Team Foundation Server构建过程的一部分。因此,我们设置构建参数[2。构建 - > 5.高级 - >执行代码分析]到
"AsConfigured"。在我们的场景中,这意味着"Microsoft All Rules"或者"AllRules.ruleset"。


但现在,我们总是在构建日志中跟踪警告(对于解决方案中的每个项目文件):



  • 警告MSB3884:找不到规则集文件"AllRules.ruleset"

作为错误分析的一部分,我们发现了(在构建日志文件中)msbuild参数"/ ruleset:"具有以下值:" / ruleset:" C:\Program Files(x86)\ Microsoft Visual Studio 14.0 \ Team Tools \静态分析工具 \\ 规则
sets\AllRules.ruleset"。


正如你所看到的,参数中有一个双反斜杠,因此,我们尝试用错误来覆盖参数并扩展我们的构建参数[2。构建 - > 5.高级 - > MSBuild参数],其值为"/ p:RunCodeAnalysis = true; CodeAnalysisRuleSet =" C:\Program
Files(x86)\ Mysoftoft Visual Studio 14.0 \ Team Tools \Static Analysis Tools \ 规则集\ AllRules.ruleset"。 (将双反斜杠更改为单反斜杠)


现在,一切正常,但我们必须使用新值扩展每个构建定义以使其工作。  


现在我的问题:是否有任何选项不通过扩展构建参数解决问题并解决原始问题(删除原始问题中的第二个"\")参数)?


谢谢!

解决方案

Hi Meik1,



感谢您在此发帖。



根据我的测试在我的Msbuild日志中还有一个双反斜杠,但MSbuild可以成功找到规则集而不会出错。所以我认为它可能与双反斜杠无关。如果指定参数:


/ p:RunCodeAnalysis = true; CodeAnalysisRuleSet =" C:\Program Files(x86)\ Microsoft Visual Studio 14.0 \ Team Tools \ Static分析工具 \\ 规则集\ AllRules.ruleset"


此问题是否发生?如果要在Msbuild中更改规则集的位置,可以在项目的.csproj中指定以下代码:

< CodeAnalysisRuleSet> .. \..\..\..\\\\..\程序文件(x86)\ Microsoft Visual Studio 14.0 \Team Tools \静态分析工具\Rule Sets \ AllRules.ruleset< / CodeAnalysisRuleSet> 

MSbuild将在指定位置找到规则集。



最好的问候


Limitxiao Gao








































































Dear community,

first, the fast facts:

  • We are using Team Foundation Server 2013 Update 4
  • and Visual Studio 2015 Update 3

As part of our quality enhancement process, we would like to use the "Static Analysis Tools" as part of our Team Foundation Server build process. Therefore, we set the Build Parameter [2. Build -> 5. Advanced -> Perform code analysis] to "AsConfigured". In our scenario this means "Microsoft All Rules" or "AllRules.ruleset".

But now, we get always following warning (for each project file in the solution) in the build log:

  • warning MSB3884: Could not find rule set file "AllRules.ruleset"

As part of our error analysis, we have discovered (in the build log file) that the msbuild parameter "/ruleset:" has following value: "/ruleset:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\\Rule Sets\AllRules.ruleset".

As you can see, there is a double backslash in the parameter and as a result, we try and error to overwrite the parameter and extended our build parameter [2. Build -> 5. Advanced -> MSBuild arguments] with the value "/p:RunCodeAnalysis=true;CodeAnalysisRuleSet="C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\AllRules.ruleset". (changed double backslash to single backslash)

Now, everything works fine, but we have to extend every build definition with the new values to get it work. 

Now my question: Is there any option not to workaround the problem by extending the build arguments and to fix the original problem (removing the second "\" in the original parameter)?

Thank you!

解决方案

Hi Meik1,

Thank you for posting here.

According to the test in my machine, there is also a double backslash in my Msbuild log, but MSbuild could find the ruleset successfully without error. So i think it may has nothing to do with the double backslash. If you specify the arguments:

/p:RunCodeAnalysis=true;CodeAnalysisRuleSet="C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\\Rule Sets\AllRules.ruleset"

Did this issue happen? And if you want to change the location of the ruleset in Msbuild, you could specify the following codes in the .csproj of the project:

<CodeAnalysisRuleSet>..\..\..\..\..\..\..\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\AllRules.ruleset</CodeAnalysisRuleSet>

The MSbuild will find the ruleset in the specified location.

Best Regards

Limitxiao Gao


这篇关于[TFS2013团队构建] [静态代码分析]参数问题中的双反斜杠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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