CA0058

Unable to load assemblies referenced.

This error occurs if the analysis tool is unable to load assemblies referenced by the assembly under analysis. As result, this error might cause CA0001 in other places because many unexpected states can arise if this occurs. If you are using the managed code analysis tool from within Visual Studio, the following are some of the reasons that might cause CA0058:

  • The input assembly was overridden and now points to an assembly that references other assemblies outside the list of references in the Visual Studioproject file.

  • If a project is modified to invoke a custom build step before FxCopCmd.exe runs and the custom build process adds more references to the input assembly, error CA0058 is generated.

  • In C++, it is possible to reference assemblies using ForcedUsing in VCPROJ, overriding the command-line to pass /FU or adding #using <Some.dll> in source only.

In all cases, the resolution for this issue is to add the missing reference to the Visual Studio project itself.