Every developer who work on Microsoft technology should have came across this situation with Visual Studio on how to add a set of files from a folder or the folder itself to Visual Studio Project solution in simple steps. There are quite few who did by first creating a new folder in the solution (Add new folder) or adding the files directly one by one which is time tedious if we have huge number of files. Always Microsoft makes developer life easier, hope everyone accepts that. Yes with Visual Studio we can directly add the folder or files without adding it manually one by one in simple steps.
First copy the files to the project folder in the explorer, just copy the files alone or if required the folder as well to the project solution folder (just do a simple ctrl+c and ctrl+v) as shown below.
Once copied open the solution in Visual Studio and navigate to Solution Explorer by View—> Solution Explorer option from the menu and you can see the solution explorer opened at the right side of the Visual Studio IDE. If you navigate through the folders you will not see Menu folder (newly copied) listed in the project solution as shown below.
At the top of Solution Explorer there is an option to list down the files which are treated as Hidden or we can term it as files which are not part of solution but still resides in the folder path. The option is called “Show all files” at the top menu in Solution Explorer window as highlighted in the screen below. Click on that and you can see the menu folder listed.
If you see the Solution explorer windows there are files with icon transparent or we can term as inactive icons. Those are the files which are not included in the project, our menu folder is one such of the files and folders listed which you can see in the screen. Now select the folder, right click on it and we can see the option “Include in Project” which does the job to include the files that are available in the folder to the solution without any hassle as shown in the screen below.
I hope this short tip will be more helpful and productive to most of the developers!!! Thanks and see you all in my next blog post, until then have a nice day!!