Take the 2-minute tour ×

I have an issue with a class being used in another project.

Visual studio is able to add a using statement using Resolve (Ctrl+.), but:

The type or namespace name 'SomeClass' could not be found (are you missing a using directive or an assembly reference?

Resolving this again fully qualifies the type but the namespace in the type path is highlighted as not being found.

The namespace appears also in intellisense and the target class is visible in the Object Browser.

Removing unused namespaces removes the added using statement.

I've tried:

  1. Rebuild.
  2. Confirm project dependency in solution options.
  3. Delete reference and re-add.
  4. Confirm class accessibility (despite namespace not being found).
  5. Checked build mode (Debug/Release).
  6. Restart Visual Studio.
  7. Cleared bin folders in both projects.
  8. Restart machine.

What is the next step to diagnosing this baffling issue?

share|improve this question
If you are targeting .NET 4 then try to change to the full version, not the Client profile. –  Hans Passant Sep 19 '11 at 17:53
Can you see the type in the Object Browser? Maybe you are not loading the assembly you think you are loading. –  Philipp Schmid Sep 19 '11 at 17:56
@Philipp, that was one of the things I tried, to make sure, will update question. –  StuperUser Sep 19 '11 at 18:06
Use a decompiler to check the class actually exists in the bin dll you are referencing. –  TheCodeKing Sep 19 '11 at 18:16
@TheCodeKing They're in there. They're so in there. I can't believe how in there they are. –  StuperUser Sep 19 '11 at 20:58

3 Answers 3

This is likely to be a .Net framework versioning issue. The class being referenced was probably built using a higher version of the framework.

Try checking your framework versions all align in properties, build settings. A project cannot reference an assembly of a higher framework version.

share|improve this answer
Nope, they are both the same version. Is there more granularity other than that Target Framework dropdown containing {2.0, 3.0, 3.5, 4.0}? –  StuperUser Sep 19 '11 at 18:02
There's whether it's client profile or not, other than that no. What you are experiencing is usually this issue. Is the dll copied to the bin? –  TheCodeKing Sep 19 '11 at 18:09
It's not, and I've gone through: msdn.microsoft.com/en-us/library/cc668079.aspx with no joy. –  StuperUser Sep 19 '11 at 18:29

Last time I had this problem my class was not marked public. Just an idea.

share|improve this answer
Thanks Decker, the namespace is what's not found and I don't think you can modify the accessibility of a namespace. Checking the class(es) was number 4 on my list. –  StuperUser Sep 19 '11 at 18:30
What happens if you put in the namespace.class.function directly? sometimes it will give rollover help for why it's not found. –  Decker97 Sep 19 '11 at 18:35
Resolving this again fully qualifies the type but the namespace in the type path is highlighted as not being found. –  StuperUser Sep 19 '11 at 18:38
up vote 0 down vote accepted

This issue was caused by similar namespaces e.g. Company.Product.Project and Product.Project with:

namespace Company.Product.Project
        using Product.Project;

The class was in Product.Project, but the compiler was searching for Company.Product.Project.

See: Should Usings be inside or outside the namespace for more details.

share|improve this answer

Your Answer


