Whenever the performance of a mitzvah constitutes the completion of one's obligation, he should recite the blessing before performing it. When, however, there is another commandment that follows the performance of a particular mitzvah, the blessing should not be recited until the other mitzvah is performed.
What is implied? When a person makes a sukkah, a lulav, a shofar, tzitzit, tefillin, or a mezuzah, he should not recite a blessing at the time he made [them]: [praising God for] "sanctifying us with Your commandments and commanding us to make a sukkah" or "a lulav," or "to write tefillin," because there is another commandment that follows this action.
When is the blessing recited? When one sits in the sukkah, shakes the lulav, hears the sounding of the shofar, wraps oneself in tzitzit, dons tefillin, or affixes the mezuzah. In contrast, when one constructs a guardrail, before constructing it one should recite the blessing "...who has sanctified us with Your commandments and commanded us to construct a guardrail." The same applies in all similar situations.