VS2010自定义代码分析规则

发布于 2024-08-25 22:17:11 字数 694 浏览 4 评论 0原文

我正在尝试为 mstest 项目 VS2010 编写自定义 fxcop 规则。我想调试它,但当它尝试加载 mstest 项目的 dll 时,不断出现异常,它失败,指出找不到引用的程序集:



  
   Microsoft.FxCop.Common.AssemblyLoadException
   Could not load C:\Users\Administrator\Documents\Visual Studio 2010\Projects\20100106-CodeAnalysisRulesBlogDemo\BlogDemo\TestProject1\bin\Debug\TestProject1.dll.
   Microsoft.FxCop.Sdk.InvalidMetadataException
   The following error was encountered while reading module 'TestProject1': Assembly reference cannot be resolved: Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.

有人知道如何解决此问题吗?如果我只是运行代码分析,它工作正常,但一旦我尝试调试它就会失败。

谢谢

I'm trying to write a custom fxcop rule for mstest projects VS2010. I'd like to debug it but keep getting an exception when it tries to load the dll for the mstest project it fails stating that it can't find referenced assembly:



  
   Microsoft.FxCop.Common.AssemblyLoadException
   Could not load C:\Users\Administrator\Documents\Visual Studio 2010\Projects\20100106-CodeAnalysisRulesBlogDemo\BlogDemo\TestProject1\bin\Debug\TestProject1.dll.
   Microsoft.FxCop.Sdk.InvalidMetadataException
   The following error was encountered while reading module 'TestProject1': Assembly reference cannot be resolved: Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.

Does anyone have any idea how to resolve this? If I just run the code analysis it works fine but as soon as I try to debug it fails.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

柳若烟 2024-09-01 22:17:11

您可以使用 /d 选项指定在程序集解析期间要搜索的其他目录。

代码分析不会自动从项目设置中获取程序集,除非您已将它们全部设置为“复制本地”。

You can use the /d option to specify additional directories to search during assembly resolving.

Code Analysis doesn't automatically fetch assemblies from the project settings, unless you've all set them to Copy-local.

东北女汉子 2024-09-01 22:17:11

解决编写 FxCop 规则的混乱问题的另一种方法是使用工具 NDepend。这个工具可以让我们编写基于 C# LINQ 查询的代码规则 我们所说的 CQLinq 免责声明:我是该工具的开发人员之一

超过200个代码默认情况下建议规则。借助众所周知的 C# LINQ 语法,自定义现有规则或创建自己的规则非常简单。

CQLinq 查询可以在 VisualStudio 中实时编辑,并提供即时结果,并具有结果浏览功能:

CQLinq 规则

可以验证规则< a href="http://www.ndepend.com/Doc_VS_CQL.aspx" rel="nofollow noreferrer">在 Visual Studio 中运行,在构建过程中,在 生成的 HTML+javascript 报告

An alternative to the mess of writing FxCop rules would be to use the tool NDepend. This tool that lets write Code Rules over C# LINQ Queries what we call CQLinq. Disclaimer: I am one of the developers of the tool

More than 200 code rules are proposed by default. Customizing existing rules or creating your own rules is straightforward thanks to the well-known C# LINQ syntax.

CQLinq queries can be edited live in VisualStudio, and offer instant result, with result browsing facilities:

CQLinq rules

Rules can be verified live in Visual Studio and at Build Process time, in a generated HTML+javascript report.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文