For solutions, projects, folders, and files, project options can be defined that are used by the project system in the build process. These project options can be viewed and modified by using the Options dialog in conjunction with the Project Explorer.

Some project options are only applicable to a given item type. For example, linker project options are only applicable to a project that builds an executable file. However, other project options can be applied either at the file, project, or solution project node. For example, a compiler project option can be applied to a solution, project, or individual file. By setting a project option at the solution level, you enable all files of the solution to use that project option's value.

Unique project options

A unique project option has one value. When a build is done, the value of a unique project option is the first one defined in the project hierarchy. For example, the Treat Warnings As Errors project option could be set to Yes at the solution level, which would then be applicable to every file in the solution that is compiled, assembled, and linked. You can then selectively define project options for other project items. For example, a particular source file may have warnings you decide are allowable, so you set the Treat Warnings As Errors to No for that particular file.

solution — Treat Warnings As Errors = Yes
    project1 — Treat Warnings As Errors = Yes
        file1 — Treat Warnings As Errors = Yes
        file2 — Treat Warnings As Errors = No
    project2 — Treat Warnings As Errors = No
        file1 — Treat Warnings As Errors = No
        file2 — Treat Warnings As Errors = Yes

In the above example, the files will be compiled with these values for Treat Warnings As Errors:

project1/file1 Yes
project1/file2 No
project2/file1 No
project2/file2 Yes

Aggregate project options

An aggregating project option collects all the values defined for it in the project hierarchy. For example, when a C file is compiled, the Preprocessor Definitions project option will take all the values defined at the file, project, and solution levels.

solution — Preprocessor Definitions = SolutionDef
    project1 — Preprocessor Definitions =
        file1 — Preprocessor Definitions =
        file2 — Preprocessor Definitions = File1Def
    project2 — Preprocessor Definitions = ProjectDef
        file1 — Preprocessor Definitions =
        file2 — Preprocessor Definitions = File2Def

In the above example, the files will be compiled with these preprocessor definitions:

project1/file1 SolutionDef
project1/file2 SolutionDef, File1Def
project2/file1 SolutionDef, ProjectDef
project2/file2 SolutionDef, ProjectDef, File2Def