Search code examples
c#visual-studioconflict

Visual studio warning - type conflict


This warning make me crazy.

Warning CS0436 The type 'TypeName' in TypeAddress conflicts with the imported type 'TypeName' in 'TypeAddress

TypeNames and TypeAddress are exactly the same.

Why Visual studio warns me about this?


Solution

  • You have defined something twice within the same namespace, which is not allowed (or to be more precise, one of them gets ignored). E.g. once in your main program, and once in a project or library that it references. You need to remove one of those definitions.

    If you can't find it then make sure that your build is up-to-date, by doing Clean Solution or Rebuild Solution.

    For more info see: https://learn.microsoft.com/en-us/dotnet/csharp/misc/cs0436