简体   繁体   中英

Visual Studio cannot find symbol and class doesn't show up in solution explorer although it is in directory

Visual studio is saying that the type or namespace name "EquipmentWebPage" could not be found (are you missing a using directive or assembly reference?)

This file, EquipmentWebPage.cs, isn't showing up in the solution explorer either; it's like it has ceased to exist. But, if I try to create a new EquipmentWebpage.cs file, I get the following error:

A file with the name "EquipmentWebPage.cs" already exists and is open in an editor. Please give a unique name to the item you are adding, or delete the existing item first.

Also, if I go to file, open existing file and browse to the src folder, I can see the file and open it. But when I try to rebuild the solution, it is still giving me the error that it cannot find that file.

Does anybody have any ideas of how to fix this, or should I just delete the file and re-add it?

Additional details: This issue started after I committed my code to perforce and pulled down latest revision. Perforce didn't say I had any conflicts or problems, and perforce still contains this file and others can pull it down and build the solution successfully; it seems completely local to my machine. I have removed my entire solution from source control to see if that helped, but nothing changed.

Also tried: Making all files in src read-only making all files in src not read-only

Edit: equipmentWebPage.cs is a file of my own creation, not from a dll or other outside source

That just means that the file exists, but isn't included in your project.

Click Show all files on the Solution Explorer toolbar, then right-click the missing file and click Include in Project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM