Questions about custom build steps

Martin Galvan 0 Reputation points

Hi, this is the same question posted at

I'm looking at the pages for adding custom build steps to an existing .vcxproj file (namely and but can't find a clear explanation on the semantics of the XML elements involved. For example, the second page I linked shows the following:

  <CustomBuild Include="faq.txt">
    <Message>Copying readme...</Message>
    <Command>copy %(Identity) $(OutDir)%(Identity)</Command>

What are the possible attributes of CustomBuild? What does Include do? What is %(Identity)? And so on.

I've actually cloned the cpp-docs repository and couldn't find any references to Identity other than so I believe the documentation is lacking here.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,776 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 28,756 Reputation points Microsoft Vendor

    Hello @Martin Galvan,

    Welcome to Microsoft Q&A forum.

    The attributes that you want to know are about MSBuild. Some are Item(MSBuild) elements.

    The explanation might not be collected in one document but scattered across different documents.

    Include is a normal attribute, you may find the explanation here: Attributes – Include

    Optional attribute.

    The file or wildcard to include in the list of items.

    As you can see, a file called faq.txt is included.

    %(Identity), there are two things. One is % or %(), the other is (Identity), or Identity.

    % is a special character in MSBuild, it usually means "referencing metadata". You may find the description here: Special characters - %

    Identity is normally used together with %(), you may find the description here: MSBuild well-known item metadata - %(Identity)

    The item specified in the Include attribute. For example: faq.txt.

    Besides, $ character means "referencing properties", $(OutDir) means path to the output file directory.

    CustomBuild should be a task(MSBuild task). As you can see => CustomBuild task, it is used to build C++ projects.

    I agree with you that the documentation that you are referring to, can be improved to add some necessary explanations/descriptions for these attributes, maybe links or short descriptions.

    I will help you to report the feedback about the documentation.



    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments