Freigeben über


MSBuild Best Practices

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

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)" == ''>

    MyDefaultValue

    </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.

See Also

Advanced Concepts