Search code examples
visual-studiodirectoryvisual-studio-2005

Ignore an entire directory in Visual Studio before a build?


I currently have a project I am building in Visual Studio 2005 and I need to be able to build the part of the project some of the time with directory A and sometimes with directory B and never both. If you right click a file (foo.f) --> Click Properties --> you can change the "Exclude File From Build" from NO to YES and the project will build w/o that individual file.

Is there a way to do this for an entire folder/directory (without individually clicking every file in the folder) so that that particular folder/directory will be ignored in the build?

NOTE: I know I could select all the files in the directory if there were not subdirectories. I realize that would work but there are many subdirectories within this main directory (1000+ files 20+ subdirectories) and using shift and selecting the top and bottom files. You cannot select them all that way; it pops up an error when you right-click!


Solution

  • Solution explorer supports multiple selection.

    • Open the directory
    • Select the top file
    • Hold shift and click on the bottom file.

    This will select every file in the directory. The right click context menu will then allow you to exclude them all as a group.

    You can get even more fine grained selection by using control to select elements.