| Doc Type | Tricks & Tips |
| Email Setting | Make Public |
| Email Address | steve dot robinson at notes411 dot com |
| Keep informed? | Yes |
| Author | SCRobinson |
| Company Name | Notes411 |
| Category | .NET, Visual Studio, c# |
| Modified | 31/05/2006 13:35:28 |
| Subject | The type or namespace name could not be found (are you missing a using directive or an assembly reference?) |
When you compile your code you receive the following
error message:
The type or namespace name <type/namespace> could not be found (are
you missing a using directive or an assembly reference?)
where <type/namespace> is the name of the type or namespace you are
trying to use.

Solution:
When you receive this compiler error, the first thing to check is spelling.
As previously noted, the most common cause is not having the correct case
for the type or namespace. If you feel certain that you have spelled the
name of the type or namespace correctly (including the correct capitalisation),
then check the following:
1. Assembly Reference:

Make sure that you have referenced the assembly that contains the namespace.
If you are developing in Visual Studio .NET, you can go to the Project
menu and click Add Reference. On the .NET tab, choose the assembly that
contains the namespace that you are trying to import, or Browse to the
folder that contains the assembly. If you are using the command-line compiler,
add the appropriate switch (/reference) to the compile statement.
2. Namespace:
Make sure that you are importing the namespace into your project by having
a using statement at the top of the code file that contains the type reference,
such as: using System.Data;
|