Up to this point, you have created a simple project. In this section, we will set some options for that project.

You can set project options on any node of a solution. That is, you can set options on a solution-wide basis, on a project-wide basis, on a project-group basis, or on an individual-file basis. For instance, options you set on a solution are inherited by all projects in that solution, by all groups in each of those projects, and by all files in each of those groups. If you set an option further down in the hierarchy, that setting will be inherited by nodes that are children of (or grandchildren of, etc.) that node. This provides a powerful way to customize and manage your projects.

Adding a C preprocessor definition

In this instance, we will define a C preprocessor definition that will apply to the entire Tutorial project. This means every file in the project will inherit our new definition. If, however, we were to later add other projects to the solution, they would not inherit the definition; if we wanted that, we could set the property on the solution node rather than the project node.

To set a C preprocessor definition on the project node:

The dialog box will now look like this:

Notice that, when you change between Debug and Release configurations, the code generation options change. This dialog shows the options used when building a project (or anything in a project) in a given configuration. Because we put the above, new definition in the Common configuration, both Debug and Release configurations will use this setting. We could, however, set the definition to be different in Debug and Release configurations if we wanted to pass different definitions into debug and release builds.

Now click OK to accept the changes made to the project.

Using the Properties Window

If you click on the project node, the Properties Window will show the properties of the project—all were inherited from the solution. If you modify a property when the project node is selected, you'll find that its value is highlighted because you have overridden the property value inherited from the solution. To restore the inherited value of a property that was changed, right-click the property and select Use Inherited Value.

Next, we'll build the project.