If you want validation to occur automatically during an automatic incremental build that occurs as a result of a resource change, you can enable automatic code validation.
If automatic incremental builds are disabled, automatic code validation cannot be enabled.
To enable automatic code validation:
If any errors are detected, an error or warning message is logged in the Problems view. These messages cannot be removed manually. Once the problem is fixed that caused the messages to be generated, the messages are automatically removed. You can, however, use the Filter Tasks wizard to temporarily filter out any messages in the Problems view until you can fix the associated problems. To open the Filter Tasks wizard, click the Filters icon in the title bar of the Problems view. Alternatively, if you do not want to see any problems detected by a particular validator, on a particular project, you can disable the validator in the project's Properties page. When a validator is disabled, all messages from that validator are removed.