zoukankan      html  css  js  c++  java
  • 代码分析—“CA0052 没有选择要分析的目标”(VS2012)

    情况:

    1.未采用代码分析时程序正常编译

    2.采用代码分析,会提示“没有选择分析目标”或“未加载制定版本的程序集”...的错误

    分析:

    是由于代码分析依赖程序集的强签名,包括版本

    解决方案:

    1.修改代码分析工具的配置项:

    FxCopCmd.exe.config里节点AssemblyReferenceResolveMode的Value值StrongName修改为StrongNameIgnoringVersion或None

    2.修改当前分析的项目:

    .csproj增加节点

    <PropertyGroup>
    <CodeAnalysisAdditionalOptions>/assemblyCompareMode:StrongNameIgnoringVersion</CodeAnalysisAdditionalOptions>
    </PropertyGroup>
    

    原文:http://stackoverflow.com/questions/26058751/visual-studio-2012-code-analysis-error-ca0058

    The underlying issue is due to the combination of two facts:

    1. Prism.UnityExtensions version 4.1.0.0 references Unity in version 2.1.505.0, with a strong name, but you have a newer version, strongly signed with version 3.0.0.0;
    2. In its default mode of operation, FxCop insists that the assembly name must match the reference, including having the exact version number, thereby ignoring assembly redirection (which is the only thing that allows that combination of assemblies to work at runtime);

    Meaning that, this mess is not your fault, simply the result of attempting to use an "unexpected" combination of library versions, and of an oversight in FxCop's assembly resolution logic.

    The main way to get past that issue is to set FxCop's AssemblyReferenceResolveMode to StrongNameIgnoreVersion. There are ways to achieve that, one on a per-machine setting, and the other on a per-project setting.

    • One is to do as you did, to set AssemblyReferenceResolveMode to StrongNameIgnoreVersion in either FxCopCmd.exe.config (from VS12 invocation) or FxCop.exe.config (command-line call to FxCop.exe);
    • The other is to add a line in each .csproj file, inside of a PropertyGroup XML element:
    <PropertyGroup>
      <CodeAnalysisAdditionalOptions>/assemblyCompareMode:StrongNameIgnoringVersion</CodeAnalysisAdditionalOptions>
    </PropertyGroup>
    

    I would recommend using the per-project setting for any project that you intend to share with other people.

    本博客所有内容均为原创,转载请注明出处!谢谢
  • 相关阅读:
    1003 Dijkstra算法
    微信公众号签名错误(invalid signature)的问题排查
    使用OpenSSL(Windows x64版)将pem格式证书转换为p12格式
    单篇文章JS模拟分页
    自制Javascript分页插件,支持AJAX加载和URL带参跳转两种初始化方式,可用于同一页面的多个分页和不同页面的调用
    仿写Windows7桌面和任务栏 HTML5+CSS3+Jquery实现
    【转载】ASP.NET线程安全与静态变量的生命周期浅谈
    ASP.NET 多线程 监控任务执行情况,并显示进度条
    再谈Cookies欺骗
    Cookies欺骗分析与防护
  • 原文地址:https://www.cnblogs.com/hepc/p/5991335.html
Copyright © 2011-2022 走看看