简体   繁体   中英

Visual Studio 2012 does not show folder has been created

I use Microsoft Visual Studio 2012. I first opened my ASP.NET project, then I created some folder as Pages, Views, Sources . But the second I open the project, Visual Studio doesn't show those folders. I cannot view them. If I make a new folder with the same name above, the IDE renders a message that the folder already exists.

Can you help me! Thank you very much!

The Visual Studio project does not parallel you filesystem. If you create a directory or add a file into a directory through Windows Explorer, it will not show up in Visual Studio. You must either create the file or folder inside Visual Studio or use the Add... dialog for the project to add existing files.

The simplest solution for me was to recopy the files/directories from the project folder and repaste them on the Visual Studio Solution Explorer panel.

That's it!

Visual Studio will automatically sync file explorer with the Visual Studio file system.

Yes, this is because Visual Studio needs all its resources explicitly listed in its project files. When you add a folder in VS, it creates it on disk and changes the project file - whereas if you've added it in Explorer, the project file won't have any information about it.

The simplest solution I find is usually to rename them in explorer, add them in Visual Studio, then move the content from the original folder into the new one.

Alternatively, you could edit the project files directly, but that's slightly more advanced and dangerous. (It's not really that hard, and probably worth experimenting with if you've committed the "known good" project file.)

Folders should show on Visual Studio as well, sometimes they are hidden, hence when you try to create the folder with the same name it will not allow you to do that. So all you need to see all the folders is go to solution explorer and click on show all files button on top of the window, then you will see the hidden folders which are in different colour, right click on folder and select include in project .

Try using Show All Files in the Project Explorer and then right click the folders to add to the project.

Did you create the folders in Windows Explorer? If not maybe your project file get corrupted

Creating folders on the disk does not necessarily mean that they will show up inside a project in Visual Studio, because projects maintain their own folder list.

If you want your folders to show up inside a project, you need to create the folders from within Visual Studio (right-click the project and select Add > New Folder).

Select The Project Name in Solution Explorer and click Show All Files. Then select the Newly added Folder or Files (Which are in dotted structure) and Right Click -> select Include In Project.

Then it will added the newly created file into your local structure(Which are shown in normal structure).

I think you are not just viewing the Solutions Explorer. Select from Menu "View --> Solution Explorer" from the menu bar. Otherwise just press Ctrl+Alt+L. You should then be able to see the folders.

You can drag and drop the folder to your solution. and go to sub folder (your folder and subfolder that you want to move to solution) and drag and drop to your folder that you just drag and drop again. Visual studio will ask you that you want to overwrite the old one. Click Yes, Now Visual studio show you all file now.

The most simple and easy solution i found is to just drag your assets(your folder) from windows explorer to visual studio project explorer bar

:p

Just go to the top of the Solution Explorer, find the button with Show All Files, and click it. It will show all of the files in the directories that you have in the Solution Explorer.

Late to the game, but since there is still a use case to add files from outside of VS--for example, dropping in a bunch of CSS & image files--the easiest way for me is to close the project in VS and then re-open.

(Using VS for Mac, v.8.)

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