I get this error message in Visual Studio when I’m trying to run the C# code:
The type or namespace name ‘Shape’ could not be found (are you missing a using directive or an assembly reference?)
Is this because I changed the location of some files in the Solution Explorer? From the beginning I had the files in a folder and then I moved them outside and erased the folder. I have tried to use rebuild solution and clean, but I still get this error.
Now I have all files in the same “level” in the Solution Explorer. What can I do to get it to work again?
A few things to try:
Make sure the class file containing the
Shapeclass is marked as “Include in project” in the Solution Explorer.In the file with the error, make sure you have an appropriate
usingstatement referencing the namespace where theShapeclass is located.If the
Shapeclass is in an external DLL, make sure it is referenced in your project.Double-check what the namespace is for the class file that contains the
Shapeclass. Depending on how you moved those files around, it may have changed and you will need to update theusingstatement where you use it.