Partager via


CA0060

Unable to load assemblies referenced indirectly.

This warning occurs if the analysis tool is unable to load assemblies that are indirectly referenced by the assembly under analysis. An "indirect reference" refers to a reference assembly that one of your analysis assembly's assembly references refers to. For example if code analysis (FxCop) is analyzing assembly A, and assembly A references assembly B, and assembly B references assembly C but A does not reference assembly C, then assembly C is an indirect reference and assembly B is a direct reference.

This might cause error CA0001 in other places because many unexpected states can occur 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 CA0060 warning:

  • The input assembly was overridden and now points to an assembly that references other assemblies outside the list of references in the Visual Studio project 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 and warning CA0060 is generated.

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

  • A third party assembly that has some private references to other assemblies that you do not need in order to compile and run your code.

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

See Also