Code analysis fails on project referencing obfuscated assembly

断了今生、忘了曾经 提交于 2019-12-10 17:44:43

问题


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

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

Project : error : CA0052 : No targets were selected.

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.

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

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?


回答1:


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

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.

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.



来源:https://stackoverflow.com/questions/3523835/code-analysis-fails-on-project-referencing-obfuscated-assembly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!