I'm building a build step to generate code metrics using the metrics.exe tool into our build pipeline. When running metrics.exe /f:MyApp.Web.dll /o:results.xml
I get the following error.
Calculating metrics for file 'C:\Code\a\MyApp.Web\MyApp.Web.dll'.
error : CA0058 : The referenced assembly 'Microsoft.Owin.Security.Cookies, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be found. This assembly is required for analysis and was referenced by: C:\Code\a\SteelAccount.Web\Microsoft.AspNet.Identity.Owin.dll.
My packages.config references <package id="Microsoft.Owin.Security.Cookies" version="3.0.0" targetFramework="net45" />
and so I can understand why the error is occurring. There is no version 2.1 of the cookies assembly.
When I generate code metrics from Visual Studio it overcomes this problem somehow. Anyone know how?
When it runs it over a solution it includes all the referenced DLL's then filters out any that aren't part of your solutions projects. So if you used this command it should include the referenced DLLs:
metrics.exe /f:drive:\solutiondirectory*.dll /o:results.xml /acm:None
Edit: I ran Metrics.exe through .Net Reflector and it turns out that there is a switch for the compare mode that allows your example to succeed. Valid values for the "/acm:" switch are: