![]() NET FrameworkĬopyright (C) Microsoft Corporation. For example: C:\source\repos\ClassLibrar圓\ClassLibrar圓>msbuild /t:Metrics After you've installed the package, run msbuild /t:Metrics from the directory that contains your project file. The easiest way to generate code metrics data from the command line is by installing the NuGet package. To run code metrics from the command line, install the NuGet package or build the Metrics.exe executable yourself. You can generate code metrics data from the command line for C# and Visual Basic projects for. To view the results details, expand the tree in the Hierarchy. The results are generated and the Code Metrics Results window is displayed. In Solution Explorer, select one or more projects.įrom the menu bar, select Analyze > Calculate Code Metrics > For Selected Project(s). Generate code metrics results for one or more projects To view the results details, expand the tree in the Hierarchy column. In the Code Metrics Results window, select the Calculate Code Metrics for Solution button. In Solution Explorer, right-click the solution and then select Calculate Code Metrics. You can generate code metrics results for an entire solution in any of the following ways:įrom the menu bar, select Analyze > Calculate Code Metrics > For Solution. ![]() Generate code metrics results for an entire solution ![]() Generate code metrics for one or all of your open projects in the IDE by using the Analyze > Calculate Code Metrics menu. In the Properties window of Visual Studio, or in the project file, mark the build action of the configuration file as AdditionalFiles. In this example, rule CA1502 is configured to fire when a method's cyclomatic complexity is greater than 10. As an example, you can name it CodeMetricsConfig.txt.Īdd the desired thresholds to the text file in the following format: CA1502: 10 You can configure the thresholds at which the code metrics rules fire.Ĭreate a text file. For example, to enable rule CA1502 as a warning, your EditorConfig file would contain the following entry: dotnet_ = warning These rules are disabled by default but you can enable them from Solution Explorer or in an EditorConfig file. NET code-quality analyzers include several code metrics analyzer rules: NET code-quality analyzers code metrics rules NET code-quality analyzers and enabling the four code metrics (maintainability) rules it contains.īy choosing the Analyze > Calculate Code Metrics menu command within Visual Studio.įrom the command line for C# and Visual Basic projects. You can generate code metrics data in three ways:īy enabling.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |