简体   繁体   中英

FxCop static code analysis .dll can be loaded for .NET

I am using .NET framework 4.5, FxCop 10, Jenkins 1.609.

I am trying to set static code analysis for .NET code. I refer from FAKE and set all environment. It's working fine for same project mention in referenced link.

Now I added my project and found that some of .dll can not be loaded because of following reason :

<Exception Keyword="CA0055" Kind="AssemblyLoad"> <Type>Microsoft.FxCop.Common.AssemblyLoadException</Type> <ExceptionMessage>Could not load BCSProducts.dll.</ExceptionMessage> <InnerType>Microsoft.FxCop.Sdk.FxCopException</InnerType> <InnerExceptionMessage>The first successfully loaded assembly for this project was linked against v2.0.50727. 'BCSProducts' was linked against v4.0.30319 and so cannot be analyzed from within the same project.</InnerExceptionMessage> <InnerStackTrace> at Microsoft.FxCop.Engines.Introspection.IntrospectionAnalysisEngine.CanLoadTargetFile(TargetFile target) at Microsoft.FxCop.Common.EngineManager.LoadTargets(TargetFile target, Boolean resetCounts, String loadEngine)</InnerStackTrace> </Exception>

I don't know what does this even mean. But I tried so many solutions by none of those are working,

I found solution.

  1. Microsoft remove support after FxCop 10. They only provide support for standalone version available for visual studio.
  2. Visual studio provides static code analysis, and they uses FxCop in backend. Which is Version 14 available.
  3. You can not analyze framework 4.5 code with FxCop 10. You have to use visual studio FxCop version 14.0
  4. We can use it just by giving path of visual studio plugin as display in screen. 在此处输入图片说明
  5. Just set source dll/exe and set result xml in violations and you are good to go.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM