Sharing the experience search

Search sharing-the-experience.blogspot.com

Monday, July 16, 2012

Are you missing a using directive or an assembly reference


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

What to check if you are missing an assembly reference?

1. Check if you have reference in References:
2. Check Build Order and Project Dependencies:
3. And finally, you may experience a strange behavior when you have added a reference, dependency and build order are right. You can even see that VS knows your dll while you developing. But when you hit build it loses the reference.
   If this is your case, check the Target framework:
The target framework should be the same for your project and the reference that you use inside.
Sometimes VS creates a project with the different target framework (based on the project type) than other projects in the solutions.
In my case , a console application project has a default .Net Framework4 Client Profile, but other projects in the solution have .Net Framework 4.

No comments:

Post a Comment