MSBuild Best Practices

We recommend the following best practices for writing MSBuild scripts:

  • Default property values are best handled by using the Condition attribute, and not by declaring a property whose default value can be overridden on the command line. For example, use

    <MyProperty Condition="$(MyProperty) == ''>



  • Avoid wildcards when you select items. Instead, specify files explicitly. This makes it easier to track down errors that may occur when you add or delete files.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft