Studio C File Folders
The way that I think of Visual Studio 2017 (earlier versions of the IDE as well) and its presentation of files in File View is as a kind of virtual file organizing system. File View allows you to logically organize files, presenting the actual file system in a more helpful manner.The icons that look like folders in the File View are not really folders but are instead labels, called filters, which allow you to group your files however you like regardless of how they are physically stored in your persistent storage area such as a hard drive.Filters are more flexible by not corresponding to the physical file folder hierarchy as they allow you to organize files that are all in a single folder into logical groups. Filters allow this to be done at a finer grain than is typically used by grouping files in folders.
Filters also allow you to group files that are in multiple folders together into a single logical folder within File View.However filters can be confusing because most of us are so accustomed to file folder hierarchies that the filter methodology can disconnect the logical file as represented in a Filter from the physical file location located in a folder.My typical methods of adding filesTypically what I do is to create the physical folders through Windows or doing a clone of an existing Git or Subversion or VS Team Services source tree. With something new I may use the New Solution or New Project wizard to create my initial starting point and then organize and add files and folders physically through Windows and then go into the Visual Studio IDE to create the Filters and then Add existing files to the Filters. In some cases I will create sub-filters within a Filter in order to better organize the files within a physical Folder.For new files I will just use the Add New Item menu option to add the item to the proper project. If you right click on a filter name, the new file will automatically be added to the filter. In some cases when I have added additional filters to the project to organize files, I will drag the newly created item to the proper filter and drop it there.This drag and drop is not changing the physical location of the file but is changing its logical position by moving it from one filter to another. To move the file physically from one folder to another, I will usually do that with Windows.
Just remember that if you do physically move a file with Windows you must also modify the file's entry in the Visual Studio 2017 filter to which it has been assigned, I usually do a Remove on the file followed by Add Existing Item and browse to its new location.It appears you can not have the same file in multiple filters within the same project.In some cases when I Add New item, I will change from the suggested folder displayed in the Add New Item dialog to a different folder using the Browse button. And if I need a different extension to the file then I will make that change as well, a common action when adding a new C source file to a project which requires changing the.cpp extension to.c.You can also use the Browse button to navigate to a folder where you can then create a new folder if you like using the right click menu that displays when you do a right click in the displayed list of files and folders.Unfortunately, the Add New Item dialog always wants to put a file into the project directory with all the other files.
Studio C Folders
The Add Class wizard doesn't give you the opportunity to specify anything other than the default project folder. I have in some cases created C classes using the Visual Studio IDE, removed them from the project, moved the physical files to where I want them to be and then added them back to the project.The filter approach seems to work well because the total solution is divided up into multiple projects and each project has its own physical folder. The multiple projects may correspond to particular DLLs or static libraries or other components that are used by the solution.See alsoExample screenshots of folder and filtersHere is a Windows folder view of a small project of the resources being used:And this is how I have the filters set up. Normally the list of resource files can be quite long however I have created two sub-filters to logically separate out bitmap files from icon files though they both share the same physical resource folder.Also the filter named PepIncludes corresponds with an actual physical folder named the same while the filters named 'Header Files' and 'Source Files' are groups of files that all reside in the same physical folder which is named the same as the project folder.The following screen shot shows how filters can provide flexibility. Fanuc robot profibus configuration. I have a folder with include files, PepIncludes, and I have the same collection of files in two different projects within this Visual Studio 2017 solution. In a solution with 30 or 40 projects, this can make it a lot easier to manage files. For instance you can see that after modifying the file 'ECR.h' the fact that it has been modified shows in both of the filter file listings (the small red check mark next to the name).