简体   繁体   中英

How can the Solution Explorer in Visual Studio Community 2019 be refreshed?

I have a basic c++ project in Visual Studio Community 2019. It contains three files: main.cpp, log.cpp, and log.h. I created a fourth file called Source.cpp and then deleted this file from the file explorer in Windows 10 to see how Visual Studio would adapt to external changes to files. Source.cpp is still visible in the solution explorer in Visual Studio.

I have tried unloading the project and reloading it but it still appears in the solution explorer. I assume it's best practice to delete files from within Visual Studio's solution explorer but there must be a way to refresh the solution explorer to reflect changes made outside of Visual Studio. Similarly, if I create a new file in the project directory (same directory as the other files in the project), it doesn't appear in the solution explorer. If I unload the project and reload the project, the new files is still not visible.

How can I refresh the solution explorer? My intention here is to better understand how Visual Studio organizes files in the solution explorer and how the organization relates to the actual file/directory structure in Windows.

After playing around with it for some time I realized that you can select the "Show All Files" button on the bar at the top of the Solution Explorer. This has a refresh button that works as expected (updates the Solution Explorer with the current state of the directory folder). It seems that files can be managed from this window and added/removed from the project in Visual Studio's default organization structure.

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