MsBuild 和 FxCop 问题 [英] MsBuild and FxCop problems

查看:41
本文介绍了MsBuild 和 FxCop 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 cmd 或 jenkins 构建作业制作一个构建文件,以便与 msbuild 一起运行.

I'm trying to make a build file to run with msbuild using cmd or jenkins build job.

项目的结构是

演示在这里:www.saramgsilva.com/wp7/sarasilvademo.rar

现在我有 3 种不同的方式来运行 fxcop,但我都遇到了问题.

Now i have 3 diferents ways to run fxcop, but i have problems in all.

1) 在 cmd 中转到根文件然后运行

1) In cmd go to the root file and then run

C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe  .\SaraSilva.WP7.build /target:FxCop

这显示一个错误:以代码 128 退出

this show a error: exit with code 128

2) 在 cmd 中转到根文件然后运行

2) In cmd go to the root file and then run

C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe  .\SaraSilva.WP7C.build /target:FxCop

这不会创建 buildartifacts\FxCop\FxCopAnalysis.xml 文件.

this doesn't create the buildartifacts\FxCop\FxCopAnalysis.xml file.

3) 在 cmd 中转到根文件然后运行

3) In cmd go to the root file and then run

C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe  .\SaraSilva.WP7.build /target:TestWithCoverage

C:\SaraSilvaDemo\tools\FxCop-1.36\FxCopCmd.exe /file:C:\SaraSilvaDemo\buildartifacts /directory:C:\SaraSilvaDemo\buildartifacts\ /rule:C:\SaraSilvaDemo\tools\FxCop-1.36\Rules /out:C:\SaraSilvaDemo\buildartifacts\fxcop-result.xml

结果是:

Microsoft (R) FxCop 命令行工具,版本 1.36 (9.0.30729.1)版权所有 (C) 2007 Microsoft Corporation.保留所有权利.

Microsoft (R) FxCop Command-Line Tool, Version 1.36 (9.0.30729.1) Copyright (C) 2007 Microsoft Corporation. All rights reserved.

加载 DesignRules.dll...加载 GlobalizationRules.dll...加载InteroperabilityRules.dll...加载 MobilityRules.dll...加载NamingRules.dll...加载 PerformanceRules.dll...加载PortabilityRules.dll...加载 SecurityRules.dll...加载UsageRules.dll... 无法加载 Cimbalino.Phone.Toolkit.dll.可以不加载 GalaSoft.MvvmLight.Extras.WP71.dll.不能加载GalaSoft.MvvmLight.WP71.dll.不能加载Microsoft.Phone.Controls.dll.不能加载Microsoft.Practices.ServiceLocation.dll.不能加载mscorlib.Extensions.dll.无法加载 NLog.dll.已加载nunit.framework.dll...加载SaraSilva.WP7.AllTests.dll...无法加载 SaraSilva.WP7.App.dll.无法加载 SaraSilva.WP7.Model.dll.无法加载 SaraSilva.WP7.SampleData.dll.不能加载SaraSilva.WP7.SchedTask.dll.无法加载 SaraSilva.WP7.Service.dll.已加载 System.Core.dll... 无法加载 System.dll.不能加载系统.Windows.Browser.dll.加载 System.Windows.dll... 无法加载 System.Windows.Interactivity.dll.无法加载 System.Xml.dll.无法加载 TombstoneHelper.dll.初始化自省引擎...无法解析对 System.Net 的引用.分析完成.

Loaded DesignRules.dll... Loaded GlobalizationRules.dll... Loaded InteroperabilityRules.dll... Loaded MobilityRules.dll... Loaded NamingRules.dll... Loaded PerformanceRules.dll... Loaded PortabilityRules.dll... Loaded SecurityRules.dll... Loaded UsageRules.dll... Could not load Cimbalino.Phone.Toolkit.dll. Could not load GalaSoft.MvvmLight.Extras.WP71.dll. Could not load GalaSoft.MvvmLight.WP71.dll. Could not load Microsoft.Phone.Controls.dll. Could not load Microsoft.Practices.ServiceLocation.dll. Could not load mscorlib.Extensions.dll. Could not load NLog.dll. Loaded nunit.framework.dll... Loaded SaraSilva.WP7.AllTests.dll... Could not load SaraSilva.WP7.App.dll. Could not load SaraSilva.WP7.Model.dll. Could not load SaraSilva.WP7.SampleData.dll. Could not load SaraSilva.WP7.SchedTask.dll. Could not load SaraSilva.WP7.Service.dll. Loaded System.Core.dll... Could not load System.dll. Could not load System.Windows.Browser.dll. Loaded System.Windows.dll... Could not load System.Windows.Interactivity.dll. Could not load System.Xml.dll. Could not load TombstoneHelper.dll. Initializing Introspection engine... Could not resolve reference to System.Net. Analysis Complete.

注意:找不到一个或多个引用的程序集.使用'/directory' 开关指定额外的程序集引用搜索路径.

NOTE: One or more referenced assemblies could not be found. Use the '/directory' switch to specify additional assembly reference search paths.

  • 未进行分析;必须至少指定一个有效的规则程序集和一个有效的目标文件.
  • 总共 2 个分析引擎异常.将报告写入 C:\SaraSilvaDemo\buildartifacts\fxcop-result.xml... 完成.

我不知道该怎么办:(

推荐答案

答案是在命令行中添加以下开关,告诉 FxCop 在 GAC 中搜索程序集:

The answer is to add the following switch to the command line to tell FxCop to search the GAC for assemblies:

/gac

这篇关于MsBuild 和 FxCop 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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