none
VS2015 Code Metrics Powertool CA0055 Error

    Question

  • Context:

    I downloaded the code metrics powertool (https://www.microsoft.com/en-us/download/details.aspx?id=48213&wa=wsignin1.0).

    • I'm using Powershell to automate the command line call.
    • I'm analyzing both new and older .dll and .exe files. 
    • I'm running the powertool on a VM where I have administrator access; analyzing files on that same VM.

    On 84% of cases (out of about 10,000), I receive the following error (where exampleFileName is a path to a file that does exist at that location):

    .\metrics : error : CA0055 : Could not load file: 'E:\exampleFileName.dll'.
    At line:48 char:13
    +             .\metrics /f:$filePath /o:$outFilePath /directory:$directory
    +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (error : CA0055 ...exampleFileName.dll'.:String) [], RemoteException
        + FullyQualifiedErrorId : NativeCommandError


    Note: I don't have FxCop.exe in the FxCop directory, just running off of metrics.exe.

    Question:

    Could this be from running the code from the ISE? Unfortunately I do not get any analysis results when this error is hit; the program just continues to the next file. I get the same results running from the Powershell console. 

    Could this be a missing reference error? (as per https://social.msdn.microsoft.com/Forums/en-US/6a9db9d2-7316-48a4-b35f-4e939c86a8e0/ca0055-could-not-load-eflanguagesalesposeidonwebintegrationdll-ca0052-no-targets-were?forum=vstscode)

    I am receiving some CA0058 missing reference errors as well, just wondering if this could be more missing reference errors not being cast correctly.

    Could this be a .NET versioning issue? (as per https://support.microsoft.com/en-us/kb/913447) 

    Are there any ways to work around this issue that do not involve changing the project files? 

    Wednesday, December 28, 2016 6:10 PM

Answers

  • Edited to add: I reviewed some of the files and can't run Code Metrics through Visual Studio because "The Project target file contains no managed code." 

    I believe that might be the case for all files that are giving errors. Thanks!

    Oscar - 

    I have not invoked fxcopcmd.exe.

    How do you check whether the input assembly property has been overridden? I would like to check this and see if that is the issue.



    • Edited by mdensley Thursday, January 05, 2017 6:54 PM
    • Marked as answer by mdensley Thursday, January 05, 2017 6:54 PM
    Thursday, January 05, 2017 5:58 PM

All replies

  • Hi mdensley,

    Based on the following blog, I could run the metcrics.exe without any problems:

    Please create a new project, and run metcrics.exe against the new project dll file to see whether has the same issue.

    If you want to access E: driver, we need to cd to E:\ first, otherwise metcrics.exe could not found the file. So you could copy the exampleFileName.dll to the C:\, and run your command line again to see the first.

    https://blogs.msdn.microsoft.com/camerons/2011/01/28/code-metrics-from-the-command-line/

    Sincerely,

    Oscar


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, December 29, 2016 6:23 AM
    Moderator
  • Oscar, 

    Thank you for your reply.

    2,000 files process correctly (out of a desired 10,000 target files). I use a script to find all target files, save their paths into a list, and then feed that list one by one into the metrics command line. I'm sending absolute paths. 

    I'll try copying the files to a folder in C:\ and see if that improves my success rate.

    Thursday, December 29, 2016 3:25 PM
  • Hi mdensley,

    Sorry to trouble you and I just want to confirm that your issue is solved or not? If not, please update your current issue and we will help you to continue researching it.

    Best regards,

    Sara


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, January 02, 2017 7:12 AM
    Moderator
  • Sara - 

    No, the issue was not resolved. The same number of files are failing with the same errors. I'm not sure if the same files are failing or just the same number of files. 

    I've been advised that all files I'm working with reference .NET 4.6.

    Tuesday, January 03, 2017 3:24 PM
  • Hi mdensley,

    Please run metrics against this exampleFileName.dll separately, I think this is related to the code in exampleFileName.dll. If it run failed, please check your code in exampleFileName.dll.

    Sincerely,

    Oscar


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, January 04, 2017 9:02 AM
    Moderator
  • Oscar - 

    I picked out a file that was giving the error. I ran metrics separately on that file. The analysis failed with the same CA0055 error. 

    What aspect of the code should I take a look at? Is there something that's likely to cause this error?

    Wednesday, January 04, 2017 3:42 PM
  • Hi mdensley,

    Based on your dll and this MSDN document CA0055:

    This error happened due to:

    The code analysis tool was unable to load the target file that was specified for analysis. This occurs if the file is not found or access to the file was denied. Typically, this occurs if the user chose to override the input assembly property in Visual Studio, or invoked fxcopcmd.exe manually.

    Please check whether you chose to override the input assembly property or invoked fxcopcmd.exe.

    Sincerely,

    Oscar


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, January 05, 2017 1:38 AM
    Moderator
  • Edited to add: I reviewed some of the files and can't run Code Metrics through Visual Studio because "The Project target file contains no managed code." 

    I believe that might be the case for all files that are giving errors. Thanks!

    Oscar - 

    I have not invoked fxcopcmd.exe.

    How do you check whether the input assembly property has been overridden? I would like to check this and see if that is the issue.



    • Edited by mdensley Thursday, January 05, 2017 6:54 PM
    • Marked as answer by mdensley Thursday, January 05, 2017 6:54 PM
    Thursday, January 05, 2017 5:58 PM
  • Hi mdensley,

    >>How do you check whether the input assembly property has been overridden?

    I do not know it. My reply is based on MSDN document. This possible reason comes from MSDN document based on the error, so I share it to you which may be helpful for you to troubleshot this issue.

    Sincerely,

    Oscar


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, January 06, 2017 1:36 AM
    Moderator