项目引用混淆程序集的代码分析失败 [英] Code analysis fails on project referencing obfuscated assembly

查看:160
本文介绍了项目引用混淆程序集的代码分析失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我们已将第 3 方程序集合并到我们的项目中,因此 Visual Studio 2010 代码分析无法运行.

Visual Studio 2010 code analysis fails to run now that we've incorporated a 3rd-party assembly into our project.

项目:错误:CA0055:无法加载 C:\Programming\MyAssembly.dll.

Project : error : CA0055 : Could not load C:\Programming\MyAssembly.dll.

项目:错误:CA0052:没有目标被选中.

Project : error : CA0052 : No targets were selected.

项目:错误:CA0058:引用的程序集'TheirAssembly,版本=1.0.0.0,文化=中立,PublicKeyToken=...'找不到.这个大会是需要分析并且是参考:C:\Programming\MyAssembly.dll.

Project : error : CA0058 : The referenced assembly 'TheirAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=...' could not be found. This assembly is required for analysis and was referenced by: C:\Programming\MyAssembly.dll.

打开第 3 方程序集 Reflector 时出现错误:

When opening the 3rd-party assembly Reflector gives the error:

NT 标头中的数据目录数无效.

Invalid number of data directories in NT header.

我在网上进行了一些搜索,看起来程序集被混淆了.

I've done some searching online and it appears that assembly is obfuscated.

有什么办法可以解决这个问题吗?我们可以从代码分析中排除这个程序集吗?

Are there any ways around this? Can we exclude this assembly from code analysis?

推荐答案

我们只是在我们的构建中遇到了这个问题.我们正在将第 3 方商业库纳入我们的代码库.

We just ran into this on our build. We're incorporating a 3rd party comercial library into our code base.

为了避免这个问题,我们将调用引用程序集的代码重构到另一个名为 ProjectName.External 的项目中,在该项目上禁用了代码分析.

To dodge the problem we've refactored out the code that calls against the referenced assembly into another project, called ProjectName.External, on which code analysis is disabled.

我们现在可以为大多数解决方案启用代码分析,但仅对使用混淆的 dll 的调用禁用它.

We can now leave code analysis enabled for most of the solution but it is disabled just for the calls that use the obfuscated dll.

不是最漂亮的,但对我们有用.

Not the prettiest but it works for us.

这篇关于项目引用混淆程序集的代码分析失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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