Deriving Cyclomatic Complexity in .NET

后端 未结 4 1652
闹比i
闹比i 2021-01-13 03:09

I know that I can access the cyclomatic complexity to my code in Visual Studio 2008 Team Explorer by right clicking and selecting \"Calculate Code Metrics\". I would like to

4条回答
  •  迷失自我
    2021-01-13 03:56

    There is no API. But you can read an XML file generated by the Code Metrics Power Tool. So you would generate the code metrics XML file by command line like:

    metrics /f:MyAssembly.dll /o:MetricsResults.xml
    

    Then grab the data you want out of MetricsResults.xml.

    More info on the power tool here.

    If you want to run code metrics in your TFS build, see here and here for options.

提交回复
热议问题