locked
FxCop error on default Analyzer + Vsix project RRS feed

  • Question


  • With VS2015 Enterprise I have created a new "Analyzer with Code Fix (NuGet + VSIX)" project. It works fine, but when I run the Microsoft FxCop rules on the solution I always got the following exceptions:

    Warning    CA0001    CA0001 : Resolved system assembly 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\Facades\System.Runtime.dll' doesn't define type 'System.Object'. Are you sure you have provided the correct system assembly?. Provided system assembly might be a facade assembly targeting another platform, such that it has only metadata and no IL. You can verify this by executing 'ildasm.exe' on this assembly.

                
    Error    CA0055    CA0055 : Could not load C:\Users\evovape3\Documents\Visual Studio 2015\Projects\Analyzer3\Analyzer3\Analyzer3.Vsix\bin\Debug\Analyzer3.dll. The following error was encountered while reading module 'System.Runtime': Assembly reference cannot be resolved: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.      

         
    Error        Code Analysis detected errors.  See Code Analysis results window or log file for details.    Analyzer3.Vsix        

    Error    CA0052    CA0052 : No targets were selected.      

    If I unload the Vsix project, the FxCop runs without failing.    

    How can I fix this exception?

    Thanks,

    Peter

    • Moved by CoolDadTx Wednesday, July 29, 2015 3:43 PM Extensibility related
    Wednesday, July 29, 2015 11:17 AM

All replies

  • Hi Peter,

    As the error messag shows, the Analyzer3.dll seems to try loading the System.Runtime of version 4.0, but as the warning message indicates, your project seems to target to .Net 4.5. So there's a probability that this VSIX project is target to .Net4.5 but reference to System.Runtime of version 4.0. Please check it out. Also see another similar question submitted by another community member:

    https://connect.microsoft.com/VisualStudio/feedback/details/733730/code-analysis-ca0055-and-ca0052-errors-when-running-against-vsix-project


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, July 30, 2015 9:07 AM
  • After setting the correct .NET I am getting another exception:

    Severity    Code    Description    Project    File    Line
    Error    CA0055    CA0055 : Could not load c:\...\visual studio 2015\Projects\Analyzer4\Analyzer4\Analyzer4.Vsix\bin\Debug\Analyzer4.dll. The following error was encountered while reading module 'mscorlib': Security attribute type does not have a default constructor: System.Security.Permissions.HostProtectionAttribute, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.            

    Any ideas?

    Peter

    Friday, July 31, 2015 10:21 AM
  • I have installed the the Microsoft .NET Framework 4.5.2 Developer Pack to avoid the warning, like mentioned here: https://support.microsoft.com/en-us/kb/2971005.

    After this I am getting the error:

    Error    CA0055    CA0055 : Could not load c:\...\visual studio 2015\Projects\Analyzer4\Analyzer4\Analyzer4.Vsix\bin\Debug\Analyzer4.dll. The following error was encountered while reading module 'mscorlib': Security attribute type does not have a default constructor: System.Security.Permissions.HostProtectionAttribute, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.            

    Any ideas?

    Peter

    Wednesday, August 5, 2015 5:08 AM