Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while adding namespace

Tags:

c#

asp.net

After lot's of effort and searching, I have decided to ask the question. I have a dll which I have added in my project and after adding namespace it shows error i.e.,

Error 1 A using namespace directive can only be applied to namespaces; 'Captcha' is a type not a namespace

enter image description here

When I have added this dll to other project it works fine but don't know what's happening in this project. I have cleaned the solution, added the dll and reference again but still the same error.

Edit:- ddl

enter image description here

After removing the dll I have typed cap but Intellisense shows nothing regarding captcha. enter image description here

like image 680
Litisqe Kumar Avatar asked Aug 19 '15 05:08

Litisqe Kumar


1 Answers

even after reading the comments, I'm pretty sure that you have a type called Captcha hiding somewhere.

You could try the object explorer, or checking inside the other dlls you have referenced (the fact that Captcha.dll works for other projects could hint you about which dll to check first).

But the message VS is giving you is pretty clear: you DO HAVE a type Captcha somewhere. I found that this is a case in which Intellisense keeps working even if the compiler is complaining.

I hope to put you in the right track.

Good luck!

Edit: just to clarify. A type can be a class, a struct or an enum.

Edit2: I just noticed you have the bin folder included in your project. Well, that is usually a really bad idea. The bin folder should be excluded from the project (right click, then "Exclude folder from project"). Then you should check your references. Just to be sure, remove all of them, and clean empty the bin folder too. Then reference the dlls through nuget or browsing to a lib folder. If you have files in the bin folder, "bad things do happen".

like image 69
A. Chiesa Avatar answered Oct 13 '22 19:10

A. Chiesa