The way for the latest visual studio versions (2015+) Is as follows:
To create a user-defined macro:
- In the Property Manager window (on the menu bar, choose View, Property Manager), open the shortcut menu for a property sheet (its name ends in .user) and then choose Properties.
- The Property Pages dialog box for that property sheet opens. In the left pane of the dialog box, select User Macros. In the right pane, choose the Add Macro button to open the Add User Macro dialog box.
- In the dialog box, specify a name and value for the macro. Optionally,
select the Set this macro as an environment variable in the build
environment check box.
Source