1

I inherited a codebase, and one of the projects has a few hundred c# files, but in solution explorer it only shows a couple. These classes are referenced in other projects, and the solution builds fine.

If I click the "Show All files" option, it will show the obj and bin folders and a config file, but none of the .cs files that exist in that folder show up there. If I go to project -> Add Existing Item and select one of the files, the project does not change. All the files I'm looking for exist in the appropriate folder.

Why are the files missing in solution explorer, but still referenced in the codebase? How do I get them to show up in solution explorer?

Douglas Gaskell
  • 9,017
  • 9
  • 71
  • 128
  • The Show All Files button is contextual I believe, so make sure you click on the proper "root" object/folder before clicking that button. – maccettura Jan 04 '18 at 20:35
  • @maccettura I have, it will show the obj and bin folders and a config file, but none of the .cs files that exist in that folder show up there. – Douglas Gaskell Jan 04 '18 at 20:36
  • It is possible that the file contains a character that cannot be displayed. I mean, the person from whom you "inherited" this project could have named a file in a different language and if you don't have the same language installed, it might fail to display the file name, thus causing the rest of the files not to display. Just a thought – nurchi Jan 04 '18 at 20:37
  • @DouglasGaskell have you checked the contents of your `.csproj` file(s) to ensure they are references? – M Y Jan 04 '18 at 20:37
  • See [this answer](https://stackoverflow.com/a/35991676). It is time to open up your project files in a text editor to try to work out why the files cannot be added. Most likely, there are [conditional statements](https://msdn.microsoft.com/en-us/library/7szfhaft.aspx) in there that Visual Studio has no mechanism for changing (thus the only way is manually). – NightOwl888 Jan 04 '18 at 20:38
  • BTW - in Visual Studio 2017 there is a [*totally new* `csproj` format](https://learn.microsoft.com/en-us/dotnet/core/tools/csproj) that may or may not be in use. It would help if you post a `csproj` sample here and/or specify which format you are using. A new feature is to include all files by default, and they can be manually excluded using ` – NightOwl888 Jan 04 '18 at 20:57
  • Right click on a folder in solution explorer where you expect to find a file and see if it's there (in Windows Explorer). Perhaps the files are not in that folder at all but somewhere else. A solution's files do not have to be in the solution folder (AFAIK). (I know this doesn't answer all of the points you've made. Just my 2 cents.) – ispiro Jan 04 '18 at 21:36

0 Answers0