Studies show that good grammar leads to more promotions and higher salaries. Write with Grammarly

C# Error CS0433 – The type TypeName1 exists in both TypeName2 and TypeName3

C# Compiler Error

CS0433 – The type TypeName1 exists in both TypeName2 and TypeName3

Reason for the Error

You’ll get this error in your C# code when you are referencing two or more assemblies in your .NET application and both contains the same namespace and type resulting in the ambiguity.

Solution

You can fix this error in your C# program by one of the below options

  • Don’t reference one of the assemblies.
  • If you have to reference both of the assemblies, use the alias feature in your C# code.