What to do now ?. I have noticed that in Output window, there are some error messages also:
C:\…\Microsoft.CSharp.targets : warning MSB3042: A namespace or class definition was found within a conditional compilation directive in the file "XXX.cs". This may lead to an incorrect choice for the manifest resource name for resource "XXX.resx".
As the message says, I have found that construction that is preventing correct Code Metrics Calculation is ussage of conditional symbols before class (or namespaces).
Wrong code sample:
// .. Working Code here
The next steps are now to remove conditional symbols and use some logic to do the same logic instead. After replacing all the symbols reported in error messages, everything is fine and Metrics are calculated correctly 🙂
I have found during my attempts to compute metrics, these important tips:
1. When Calculation of Metrics finishes with error message, it is good to do Code Analysis before. This will usually show you the exact place where the problem lies.
2. When you have strongly named assembly (signed with a key), it cannot be linked to another (not signed one) in Code Analysis and in Metrics Calculation.