Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The type <type> exists in both DLLs

Tags:

c#

.net

I have 1 DLL in the .Net 3.5 framework and another in 2.0. The ListBoxItem class exists in 2.0 and I have linked the class in the 3.5 DLL in the same namespace.

When I try to compile I get an "exists in both" error. How can I compile this and maintain the same structure.

I don't want reference the 2.0 DLL to 3.5 to eliminate this problem, I want keep these DLLs separate.

like image 319
pedrofernandes Avatar asked Jun 29 '09 11:06

pedrofernandes


2 Answers

This doesn't seem like a good idea no matter what, but change the namespaces and fully qualify your usages.

Otherwise, why don't you just reference one dll?

like image 89
Bryan Rowe Avatar answered Oct 30 '22 08:10

Bryan Rowe


This is a relevant solution as well, where you can define which type to use in your usings:

https://stackoverflow.com/a/9194582/178620

You can't use fully qualified names when dealing with Extension methods and etc.

like image 5
Doguhan Uluca Avatar answered Oct 30 '22 08:10

Doguhan Uluca