Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The type 'x' in 'x.cs' conflicts with the imported type 'x' [closed]

Tags:

c#

What is causing this build error?

The type 'AriaLibrary.AriaBL.Book' in

'I:\Programing\MyProgram\Library\AriaNetDelijanCorporation\AriaLibrary\AriaBL\AriaBL.cs'

conflicts with the imported type

'AriaLibrary.AriaBL.Book' in

'i:\Programing\MyProgram\Library\AriaNetDelijanCorporation\AriaLibrary\bin\Debug\AriaLibrary.exe'.

Using the type defined in 'I:\Programing\MyProgram\Library\AriaNetDelijanCorporation\AriaLibrary\AriaBL\AriaBL.cs'.

I:\Programing\MyProgram\Library\AriaNetDelijanCorporation\AriaLibrary\UI\Document\Book\frm_AddNewBookISO.cs 24 16 AriaLibrary

like image 805
user818566 Avatar asked Jul 22 '11 12:07

user818566


2 Answers

You have added a reference to the output of the project.

In other words, when trying to compile your project, AriaLibrary, to produce AriaLibrary.exe, the compiler imports the assembly AriaLibrary.exe. On disk, this file exists from a previous build.

As such, the compiler finds two of that class, one that it tries to compile now, and one from that previous build, and thus you get the warning.

Since there is no valid reason for having the output a project being imported as a reference to itself, you can safely remove that reference.

Check the references list of the AriaLibrary project and remove the reference with the same name, AriaLibrary.

like image 131
Lasse V. Karlsen Avatar answered Jan 27 '23 20:01

Lasse V. Karlsen


This happens when a Type namespace in your code has the same signature as a namespace in an imported DLL.

So in your case it seems you have a namespace AriaLibrary.AriaBL.Book in your code which also exists in a referenced assembly

like image 39
jaywayco Avatar answered Jan 27 '23 21:01

jaywayco