How to: Compile Example Code for Visual C++ Code Model Extensibility
Most reference topics in the Visual C++ Code Model Extensibility reference contain a code example. This code example has been tested to compile in the Macro environment and run in the Visual Studio development environment while a C++ project is active.
The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. These procedures were developed with the General Development Settings active. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.
To compile and run a code example with the macro editor
On the View menu, point to Other Windows and then click Macro Explorer.
Right-click Module1 and click Edit on the shortcut menu.
This opens the Visual Studios Macros environment.
Right-click the References folder and click Add Reference on the shortcut menu.
In the Add Reference dialog box, click Microsoft.VisualStudio.VCCodeModel to select it, click Add, and click OK.
Add the following code to the top of the module file:
Add the sample code from the reference topic to the module file.
Right-click MyMacros and click Build on the shortcut menu.
Close the Visual Studios Macros environment.
On the Tools menu, point to Macros, and then click Macro Explorer.
Right-click the procedure name (from Module1) and click Run from the shortcut menu.