Resolve errors and warnings related to assembly references

  • CS0012: The type 'type' is defined in an assembly that is not referenced. You must add a reference to assembly 'assembly'.
  • CS0234: The type or namespace name does not exist in the namespace (are you missing an assembly reference?)
  • CS0246: The type or namespace name could not be found (are you missing a using directive or an assembly reference?)
  • CS0400: The type or namespace name could not be found in the global namespace (are you missing an assembly reference?)
  • CS0735: Invalid type specified as an argument for TypeForwardedToAttribute attribute.
  • CS1068: The type name could not be found in the global namespace. This type has been forwarded to another assembly. Consider adding a reference to that assembly.
  • CS1069: The type name could not be found in the namespace. This type has been forwarded to another assembly. Consider adding a reference to that assembly.
  • CS1070: The type name could not be found. This type has been forwarded to another assembly. Consider adding a reference to that assembly.
  • CS1704: An assembly with the same simple name has already been imported. Try removing one of the references or sign them to enable side-by-side.
  • CS1714: The base class or interface of this type could not be resolved or is invalid.
  • CS1760: Multiple assemblies refer to the same metadata but only one is a linked reference (specified using /link option); consider removing one of the references.
  • CS7008: The assembly name is reserved and cannot be used as a reference in an interactive session.
  • CS7068: Reference to type claims it is defined in this assembly, but it is not defined in source or any added modules.
  • CS7069: Reference to type claims it is defined in another assembly, but it could not be found.
  • CS7071: Assembly reference is invalid and cannot be resolved.
  • CS7079: The type is defined in a module that has not been added. You must add the module.
  • CS8090: There is an error in a referenced assembly.
  • CS8203: Invalid assembly name.

In addition, the following warnings are covered in this article:

  • CS1683: Reference to type 'Type Name' claims it is defined in this assembly, but it is not defined in source or any added modules.

Missing references

The following errors and warnings indicate that you're missing an assembly reference:

  • CS0012: The type 'type' is defined in an assembly that is not referenced. You must add a reference to assembly 'assembly'.
  • CS0234: The type or namespace name does not exist in the namespace (are you missing an assembly reference?)
  • CS0246: The type or namespace name could not be found (are you missing a using directive or an assembly reference?)

These compiler errors indicate one of these problems in your code:

Type forwarding

  • CS1068: The type name could not be found in the global namespace. This type has been forwarded to another assembly. Consider adding a reference to that assembly.
  • CS1069: The type name could not be found in the namespace. This type has been forwarded to another assembly. Consider adding a reference to that assembly.
  • CS1070: The type name could not be found. This type has been forwarded to another assembly. Consider adding a reference to that assembly.

These errors indicate an error referencing a type forwarded to a different assembly. To address any of these errors, add a reference to the assembly indicated in the error message.

Duplicate references

The following errors indicate a duplicate assembly reference:

  • CS1704: An assembly with the same simple name has already been imported. Try removing one of the references or sign them to enable side-by-side.
  • CS1760: Multiple assemblies refer to the same metadata but only one is a linked reference (specified using /link option); consider removing one of the references.

To fix these errors, you must either remove one of the references, or resolve the duplication. Causes for duplication include:

  • Multiple unsigned assemblies have the same name.
  • Your project references multiple versions of the same assembly.

Invalid assembly reference

The following errors indicate that an assembly reference is invalid:

  • CS7008: The assembly name is reserved and cannot be used as a reference in an interactive session.
  • CS7069: Reference to type claims it is defined in another assembly, but it could not be found.
  • CS7071: Assembly reference is invalid and cannot be resolved.
  • CS7079: The type is defined in a module that has not been added. You must add the module.
  • CS8090: There is an error in a referenced assembly.
  • CS8203: Invalid assembly name.

The following warning also indicates an invalid reference assembly:

  • CS1683: Reference to type 'Type Name' claims it is defined in this assembly, but it is not defined in source or any added modules

Check that the assembly name is spelled correctly. The referenced assembly file might be invalid.