FxCop analysis not finding indirectly-referenced a

2019-05-29 13:39发布

问题:

I am running my DLL against FxCop and it is returning problems as seen in the image here (It also complains about System.Windows.Browser and System.Core, same versions):

I have told FxCop to search the GAC and it isn't helping. I do have System.Runtime.Serialization referenced in my project but it is showing as version 4.0.0.0. I do not see this particular version of the file anywhere.

Although I can skip it means it fails when I use FxCop Integrator in Visual Studio and I don't know what would happen if I tried to integrate into a automatic build.

But more to the point I am curious as to how you fix it as I don't like not understanding whats wrong.

回答1:

BCL DLLs with version 2.0.5.0 are part of Silverlight 4, which you presumably have not installed on your dev machine. Since you are presumably making no use of the parts of the Esri.ArgGIS.Client.dll assembly that target Silverlight, you could probably safely ignore the warning.

There seems to be an open issue for FxCop Integrator regarding this problem, so you have three basic choices:

  1. Keep things as-is and hope that an option for ignoring these warnings will be introduced in FxCop Integrator reasonably soon,
  2. Stop using FxCop Integrator, or
  3. Install Silverlight 4.

For automated builds, the behaviour will depend on your build platform. Instead of trying to guess what might happen in an automatic build, why don't you go ahead and try it?



回答2:

Please take a look at this answer: https://stackoverflow.com/a/20799480/698

You might still be using FxCop 10.0, which doesn't handle this situation with the PCL.

Once I switched to using either the VS.NET 2012 or VS.NET 2013 FxCop binaries, it worked again.

You included a screenshot in the question. Unfortunately, FxCop11 and FxCop12 do not come with a UI version (since it is integrated into VS.NET)