An error occurred while calculating code metrics

我只是一个虾纸丫 提交于 2019-12-21 04:21:17

问题


Issue description

When I tried to run code metrics in Visual Studio 2013 for c# project (Analyze -> Calculate Code Metrics for Solution) I get following error:

"an error occurred while calculating code metrics"

This error occurred even for the newly created project, so it was not related with some reference issues.

Solution

To solve this issue I've executed following command as an Administrator:

regsvr32 "C:\Program Files (x86)\Common Files\microsoft shared\MSEnv\VsLangproj.olb"

Conclusion

  • I've verified that this issue is not occurring on newly installed VS 2013 (installer with update 4 included), which means that this could be related with updating to "update 4".

回答1:


The issue happened due to - few of my Visual Studio projects was referring reference, for which the source was not available, as shown in the image below:

Removing those reference enabled the Code Matrices functionalities to be working again.




回答2:


For users who are using vs2017 15.8 .net core, this is a bug which will be fixed in next release(Dev16). Until then you can use vs2015 or wait for an update.

Click here checkout, this issue on c# roslyn

And pull request which will fix this issue.




回答3:


To solve this on Windows,

  1. Open command window by clicking the Start button. In the Search box, type Command Prompt, and then, in the list of results, right-click Command Prompt and then select "Run as Administrator" from the selection menu.
  2. In the command prompt window paste the following command:

    regsvr32 "C:\Program Files (x86)\Common Files\microsoft shared\MSEnv\VsLangproj.olb"

  3. Hit return to run the above command, a successfully registered dialog box should be shown



来源:https://stackoverflow.com/questions/28072374/an-error-occurred-while-calculating-code-metrics

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!